$this->registerJs( "// If you use $(document).on, it will handle also events on elements rendered by AJAX.
// $(document).on('click','a.openInModal',function(e){
// And if you use $('a.openInModal'), it will work only on standard elements
$('a.openInModal').click(function(e){
// Prevents the browsers default behaviour (such as opening a link)
// ... but does not stop the event from bubbling up the DOM
e.preventDefault();