javascript - Jquery on php in div box not working -


i have main php load php div box via dropdown list. loaded php contains table. there jquery in alert on row clicked.

$(document).ready(function() {     $('#newstable tr').click(function(){     var clickedid = $(this).children('td:first').text();     alert(clickedid);     }); }); 

but after loaded div, script not firing

use event delegation attach event. event delegation allows attach single event listener, parent element, fire descendants matching selector, whether descendants exist or added in future.

   $(document).ready(function() {      $(document).on('click','#newstable tr',function(){        var clickedid = $(this).children('td:first').text();        alert(clickedid);      });    }); // end 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -