$(".fa-plus").parents("button").on("click",function(){
console.log(id);
}
});按钮在+和-之间切换,手风琴正适当地打开和关闭,但是我仍然在从控制台读取日志语句,即使是在fa-减号上。
发布于 2014-08-02 22:21:23
事件处理程序仍然附加到DOM元素。
你可以试试像这样的jsBin。
var hasPlus = $target.hasClass('fa-plus');
if (hasPlus) {
doSomething();
}https://stackoverflow.com/questions/25099468
复制相似问题