我想检测两个元素点击:获取jQuery选择兄弟
1) class is called advancedTargeting
2) the sibling li of the li that has the `area` attribute.
例如第二需求:
<li area style='display:block'>bla</li>
<li>123</li>
<li>356</li>
所以我要赶在同级里的点击的李区。在这个例子中,我想要获得关于li的onclick,他的文本是:123
。
<li area style='display:block'>bla</li>
<li>356</li>
(在这个例子中,点击356立)..
他们应该是相同的功能。
我觉得应该这样做:
$('.advancedTargeting, li[area]:next').live('click', function() {
});
顺便说一句,你应该看看使用HTML5的'数据'的属性,而不是来了你自己。 ref:http://ejohn.org/blog/html-5-data-attributes/ –