$(".parButton").each(function() {
$(this).bind("click",function(){
alert(1111);
})
});
".parButton"There are multiple Buttons. This will determine whether the currently clicked one can be selected. Why when I execute this line of code, the first ".parButton" Button is always executed multiple times.
三叔2017-06-30 09:59:35
I have no problem running your code,
$(".parButton").each(function(index,item) {
console.log(index);
$(this).bind("click",function(){
console.log(this);
$(this).hide();
})
});
I executed it like this, and one click disappears. Or is it a problem with the button? Can I try changing the button to p? Or you can print out the element you get every time you click to see if it is the element you clicked.