1var counter = 0;
2
3$("button").click(function() {
4 $("h2").append("<p class='test'>click me " + (++counter) + "</p>")
5});
6
7// With on():
8
9$("h2").on("click", "p.test", function(){
10 alert($(this).text());
11});
1$( "#dataTable tbody" ).on( "click", "tr",
2function() {
3console.log( $( this ).text() );
4});