Reputation: 137
I have an issue, Jquery onclick not triggered for dynamic created elements. I am using Jquery 1.9 and tried the example with "ON" and "LIVE". But still its not working. can some 1 help me?.
$("input[type=checkbox]").on("click", function (e) {..});
Demo: Fiddle
Upvotes: 0
Views: 381
Reputation: 941
Please add your function into document.ready
$(document).ready(function(){
$("input[type=checkbox]").on("click", function (e) {..});
})
I think it will help you to solve your issue.
Demo: fidder
Upvotes: 0
Reputation: 1523
If you have create and append elements using javascript, you have to set new event handler for that. event handlers set before adding the elements will not work for those elements.
Upvotes: 0
Reputation: 388316
Change the event handler to
$(document).on("click", "input[type=checkbox]", function (e) {
Upvotes: 1