I have the following handler in my page that works fine in Firefox, but apparently is not being attached in IE8, since it adds the parameters to the URL, and does not make any ajax calls the server:
$('#editBox form').live('submit',function(event){
var daId = $('#editBox #id').val();
$.post(
'/edit.php',
{
company: $('#company',this).val(),
name: $('#name',this).val(),
email: $('#email',this).val(),
id: daId
},
function(response){
sel = 'tr#' + daId;
$(sel).html(response)
.animate({backgroundColor: 'yellow'},500)
.animate({backgroundColor: 'white'},500);
$(sel + ' td:nth-child(3)').addClass('lastCell');
});
$('#editBox').hide('fast', function(){
toggleHider();
$(this).remove();
});
updateSorting();
consoleMessage('User changes saved');
return false;
});
How can I make this work in both IE and FF?
Update
I'm still not able to get this working right. Using Joel's solution below, here's what I have:
function BindSubmit()
{
$('#editBox form').unbind('submit').bind('submit', function() {
var daId = $('#editBox #id').val();
$.post(
'/webadmin/CDAdmin/editrep.php',
{
company: $('#company',this).val(),
name: $('#name',this).val(),
email: $('#email',this).val(),
id: daId
},
function(response){
sel = 'tr#' + daId;
$(sel).html(response)
.animate({backgroundColor: 'yellow'},500)
.animate({backgroundColor: 'white'},500);
$(sel + ' td:nth-child(3)').addClass('lastCell');
});
$('#editBox').hide('fast', function(){
toggleHider();
$(this).remove();
});
updateSorting();
consoleMessage('User changes saved');
return false;
});
}
And here's how I'm trying to use it:
$tr.live('click',function(event){
if ( $('#editBox').length ){
$('#editBox').remove();
}
var eb = $('<div>').attr('id','editBox');
$('#startEditBox').children().clone(true).appendTo(eb);
BindSubmit();
But it doesn't work. Now, the event isn't attached in either FF or IE.