jquery var ids=$(this).attr("id"); alert(ids);为什么提示undefined
$(document).ready(function(){$("li").mouseover(function(){$(this).css("background","#...
$(document).ready(function(){
$("li").mouseover(function(){
$(this).css("background","#ccc")
.siblings().removeAttr("style");
var ids=$(this).attr("id"); alert(ids);
var id=ids.substring(ids.lastIndexOf('_'));
var selid="#select"+id;
$(selid).show()
.siblings().hide();
});
});
</script>
<div class="rightcontent">
<div class="tabMenu">
<ul class="menu">
<li class="ab_1">服务车辆</li>
<li class="ab_2">关于我们</li>
<li class="ab_3">产品功能</li>
<li class="ab_4">行业说明</li>
</ul>
</div>
<div class="content">
<div class="layout" id="select_1">先不搞内容1</div>
<div class="layout" id="select_2">先不搞内容2</div>
<div class="layout" id="select_3">先不搞内容3</div>
<div class="layout" id="select_4">先不搞内容4</div> 展开
$("li").mouseover(function(){
$(this).css("background","#ccc")
.siblings().removeAttr("style");
var ids=$(this).attr("id"); alert(ids);
var id=ids.substring(ids.lastIndexOf('_'));
var selid="#select"+id;
$(selid).show()
.siblings().hide();
});
});
</script>
<div class="rightcontent">
<div class="tabMenu">
<ul class="menu">
<li class="ab_1">服务车辆</li>
<li class="ab_2">关于我们</li>
<li class="ab_3">产品功能</li>
<li class="ab_4">行业说明</li>
</ul>
</div>
<div class="content">
<div class="layout" id="select_1">先不搞内容1</div>
<div class="layout" id="select_2">先不搞内容2</div>
<div class="layout" id="select_3">先不搞内容3</div>
<div class="layout" id="select_4">先不搞内容4</div> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询