dynamically created element onclick code example
Example 1: document on click dynamic element
$(document).on('click', '.class', function() {
// do something
});
Example 2: change event doesn't work on dynamically generated elements .
$( "#dataTable tbody" ).on( "click", "tr",
function() {
console.log( $( this ).text() );
});