why we using on click in jquery code example
Example 1: on click jquery
$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});
Example 2: set onclick jquery
$(elem).click(myFunc());
$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});
$(elem).click(myFunc());