Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在div.button ol.control li有类时禁用点击active。已经用了.bind(),但是还是不行,求大神帮忙,谢谢!
div.button ol.control li
active
.bind()
这是我的脚本http://jsfiddle.net/surya31/HcaBS/
$('your-selector').click(function(){ if($(this).hasClass('active')) return false; });
您不需要禁用,您可以在选择器中显式否定它:
$('div.button ol.control li:not(.active)').click(function(){ ...