如下
html:
<div class="welfare_list">
<ul class="title" id="tab_0">
<li>
<dl class="fl">手机尾号(8909)</dl>
<dl class="fr arrow"><i class="fa fa-chevron-up"></i></dl>
</li>
</ul>
<ul class="content hide" id="content_0">
<li>
<dl class="fl">设备编号:<span>21502156456254</span></dl>
<dl class="fl"></dl>
<dl class="fr"><a href="" class="button gray">领取</a></dl>
</li>
</ul>
</div>
<div class="welfare_list">
<ul class="title" id="tab_1">
<li>
<dl class="fl">手机尾号(8909)</dl>
<dl class="fr arrow"><i class="fa fa-chevron-up"></i></dl>
</li>
</ul>
<ul class="content" id="content_1">
<li>
<dl class="fl">设备编号:<span>21502156456254</span></dl>
<dl class="fl"></dl>
<dl class="fr"><a href="" class="button gray">领取</a></dl>
</li>
</ul>
</div>
<div class="welfare_list">
<ul class="title" id="tab_2">
<li>
<dl class="fl">手机尾号(8909)</dl>
<dl class="fr arrow"><i class="fa fa-chevron-up"></i></dl>
</li>
</ul>
<ul class="content hide" id="content_2">
<li>
<dl class="fl">设备编号:<span>21502156456254</span></dl>
<dl class="fl"></dl>
<dl class="fr"><a href="" class="button gray">领取</a></dl>
</li>
</ul>
</div>
JS:
$(document).ready(function(){
var tab = document.getElementsByClassName('welfare_list');
for (var i = 0; i < tab.length; i++) {
$('#tab_'+i).on('click', function() {
if ($('#content_'+i).is(':hidden')) {
$('#content_'+i).slideDown('fast');
$('#tab_'+i+' .arrow').html('<i class="fa fa-chevron-down"></i>');
} else {
$('#content_'+i).slideUp('fast');
$('#tab_'+i+' .arrow').html('<i class="fa fa-chevron-up"></i>');
}
});
};
});
请问哪里有问题呢?这样弄,点击无效~
慕神8447489
慕工程0101907
慕婉清6462132
守着星空守着你
相关分类