Thursday, 13 March 2014

jQuery live click




"Live" means that your click event will work on items that are dynamically added to the DOM.

$("#button").live( "click" , function() {
  console.log( "click!" ); // jQuery 1.3+
});
$(document).on( "click" , "#button" , function() {
  console.log( "click!" );  // jQuery 1.7+
});

No comments:

Post a Comment