Reputation:
Why is this not working?
<div id="download">
<button>Download</button>
</div>
$("#download").find( ":button" ).click(function () {
alert("io");
});
I tried adding a class and an Id to the button element. I also tried
<button>Download</button>
$(':button').click(function(){
alert("io");
}
Upvotes: 1
Views: 1165
Reputation: 123739
:button
matches only <input type="button"...
so try:
$(function(){ //And i would wrap it in DOM ready wrapper if the script is loaded earlier than the element in DOM.
$("#download").find("button").click(function () {
alert("io");
});
});
Upvotes: 2