Skip to main content
added 6 characters in body
Source Link
iConnor
  • 20.2k
  • 14
  • 66
  • 98

You bind the elements on document ready, it's before they're created. You have to bind AFTER their creation.

Alternatively you can bind their container on document.ready:

$("#containerDiv").on('click', "input[name='todo']", function(){
   // .... your code
});
  • "containerDiv" should be the parent element of those checkboxes, it should be in the page on document ready!

You bind the elements on document ready, it's before they're created. You have to bind AFTER their creation.

Alternatively you can bind their container on document.ready:

$("#containerDiv").on('click', "input[name='todo']", function(){
.... your code
});
  • "containerDiv" should be the parent element of those checkboxes, it should be in the page on document ready!

You bind the elements on document ready, it's before they're created. You have to bind AFTER their creation.

Alternatively you can bind their container on document.ready:

$("#containerDiv").on('click', "input[name='todo']", function(){
   // .... your code
});
  • "containerDiv" should be the parent element of those checkboxes, it should be in the page on document ready!
Source Link
benams
  • 4.7k
  • 10
  • 36
  • 81

You bind the elements on document ready, it's before they're created. You have to bind AFTER their creation.

Alternatively you can bind their container on document.ready:

$("#containerDiv").on('click', "input[name='todo']", function(){
.... your code
});
  • "containerDiv" should be the parent element of those checkboxes, it should be in the page on document ready!