I have a simple table which has a some information displayed. To view the details of that row i have a javascript function:
$('#production tr').bind("click", function(){
reviewProductionOrder(this);
});
This lets me select the row and display information appropriately. However i have a date picker on top which filters the results accordingly
$('#view').bind("click", function(){
var from_date = $('#from_date').val();
var to_date = $('#to_date').val();
$.ajax({
type : "post", url : "data.php", data : "from_date=" + from_date + "&to_date=" + to_date,
success : function(data) {
if(data != '')
$('#production tbody').html(data);
}
});
});
The function above lets me add the data to the table. Now i thought that bind would let me bind the javascript function to the newly generated rows. However when i click on those rows, i am unable to do so.
Use on()
the
$(document)part must be a parent element the element you want to listen on the event for, from theon()doc page :