I need to add a handler for the click
event of future <div>
elements, that don't exist yet. Normally, I would use jQuery's .live
function to handle this, but it seems that it is now deprecated in favor of .on
.
To use the .on
method in this manner, jQuery suggests setting the selector parameter, to allow creating a delegated event, and offers this example code:
$("#dataTable tbody").on("click", "tr", function(event){
alert($(this).text());
});
That's all fine and good, but what do I put in for my intial selector, where they have #dataTable tbody
? Note that $.on()
doesn't work.