$(document).on("click", ".onClass", function () {
//your code
var element = $(this); // to get clicked element
});
$( "p" ).on( "click", function() {
alert( $( this ).text() );
});
$(document).on("click","#test-element",function() {});
$(document).on('click' , '.class' , function(){
//event
})
$(document).on('click touch', '.your-element', function () { ... });
1
2
3
$( "#dataTable tbody" ).on( "click", "tr", function() {
console.log( $( this ).text() );
});
var myEl = document.getElementById('myelement');
myEl.addEventListener('click', function() {
alert('Hello world');
}, false);
myEl.addEventListener('click', function() {
alert('Hello world again!!!');
}, false);