当我尝试使用 jQuerynext()方法时,它不适用于live().
首先,这是我的代码:
$(".toggle_button").live('click', function() {
$(this).html($(this).html() == '-' ? '+' : '-');
$(this).next(".info_section").toggle(400);
});
这是HTML
<div class='section_toggle_container'>
<div class='toggle_button'>-</div>
<strong>Driver Information:</strong>
</div>
<div class='info_section'>
info here
</div>
问题是否可能在于.toggle_button嵌套的事实,使.info_section无法访问?
第二行效果很好,因为它正在修改给定live()事件的元素。然而,第三行是问题所在。这是因为它使用next().
谁能帮我解决我的next()问题?