Why selector ":button" doesn't work with click event?
javascript, jquery
Solution
Make sure you put your code in the jQuery document ready function:
$(function(){
/** YOUR CODE **/
$(":button").click(function () {
alert("click");
return false;
});
});
But as I see from your comments on the OP, you actually might want to do this:
$(function(){
/** YOUR CODE **/
$(":submit").click(function () {
alert("click");
return false;
});
});
Problem
Hi I'm using the Jquery selector ":button" but doesn't work combine with click event.... ``` $(":button").click(function () { alert("click"); return false; }); ```