js怎么获取当前点击的div里面 span里面的值
<li><divclass="vt-el-inner"><divclass="inner-logo"><imgsrc="../PPIMG/001.jpg"></div><...
<li>
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/001.jpg">
</div>
<div class="inner-title"><span>1</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">7899票</div>
<button class="vote-send fr" onclick="asd(this)">投TA一票</button>
</div>
</div>
</li>
<li>
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/002.jpg">
</div>
<div class="inner-title"><span>2</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">789票</div>
<button class="vote-send fr" onclick="asd(this)">投ta一票</button>
</div>
</div>
</li>
var s= parseInt($(e).prev().text());
我这样不行求大神帮忙 展开
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/001.jpg">
</div>
<div class="inner-title"><span>1</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">7899票</div>
<button class="vote-send fr" onclick="asd(this)">投TA一票</button>
</div>
</div>
</li>
<li>
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/002.jpg">
</div>
<div class="inner-title"><span>2</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">789票</div>
<button class="vote-send fr" onclick="asd(this)">投ta一票</button>
</div>
</div>
</li>
var s= parseInt($(e).prev().text());
我这样不行求大神帮忙 展开
2018-05-08
展开全部
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<li>
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/001.jpg">
</div>
<div class="inner-title"><span>1</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">7899票</div>
<button class="vote-send fr" onclick="asd(this)">投TA一票</button>
</div>
</div>
</li>
<li>
<div class="vt-el-inner">
<div class="inner-logo">
<img src="../PPIMG/002.jpg">
</div>
<div class="inner-title"><span>2</span>马格全屋定制</div>
<div class="inner-btn">
<div class="vote-count fl">789票</div>
<button class="vote-send fr" onclick="asd(this)">投ta一票</button>
</div>
</div>
</li>
<script type="text/javascript" src="jquery-3.2.1.js"></script>
<script type="text/javascript">
function asd(obj){
var ret = $(obj).parent().siblings(".inner-title").find("span").html();
console.log(ret)
}
</script>
</body>
</html>
需要引入jquery
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询