i used to be able to use the below code to hide a row when a user clicked delete, for what reason this has stopped working
$(document).ready(function () {
$('.deleteRecord').live( function() {
if(confirm("Are you sure?")){
$(this).closest('tr').fadeOut();
}
});
});
haml line
\#{link_to image_tag('/img/icons/packs/diagona/16x16/101.png', :border => 0), schedule, :method => :delete, :remote=>true, :class=>'deleteRecord'}
this is what i have within my application.js, and all other events seem to be working or triggering, minus this
//= require jquery
//= require rails
//= require jquery_ujs
//= require jquery-ui
//= require best_in_place
//= require plugins
//= require messages
//= require_self
$(document).ready(function() {
jQuery(".best_in_place").best_in_place();
$('.best_in_place').bind("ajax:success", function(){
$(this).closest('tr').effect("pulsate", { times:3 }, 500);
});
});
$(window).load(function () {
$('#tab-panel-1').createTabs();
$('#dataTable').dataTable(
{
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"aaSorting": [[ 4, "desc" ]]
}
);
});
$(document).ready(function () {
$('.deleteRecord').on('click', function() {
if(confirm("Are you sure?")){
$(this).closest('tr').fadeOut();
}
});
$('#notice').effect("pulsate", { times:3 }, 500);
});
I think you misuse the
livefunction:And now,
liveis deprecated, so just useonjQuery api .on()
EDIT
Event handlers are bound only to the currently selected elements; they must exist on the page at the time your code makes the call to .on().
The usage of
onorlivedepends on your purpose.