click event working in Chrome but error in Firefox and IE
Posted
by
Hunter Stanchak
on Stack Overflow
See other posts from Stack Overflow
or by Hunter Stanchak
Published on 2012-09-09T03:05:17Z
Indexed on
2012/09/09
3:38 UTC
Read the original article
Hit count: 118
I am writing a messaging system with jquery. When you click on a thread title with the class '.open_message', It opens a thread with all the messages for that thread via Ajax. My issue is that when the thread title is clicked it is not recognizing the id attribute for that specific thread title in firefox and IE. It works fine in chrome, though. Here is the code:
$('.open_message').on('click', function(e) {
$(this).parent().removeClass('unread');
$(this).parent().addClass('read');
$('.message_container').html('');
var theID = e.currentTarget.attributes[0].value;
theID = theID.replace('#', '');
var url = '".$url."';
var dataString = 'thread_id=' + theID;
$('.message_container').append('<img id=\"loading\" src=\"' + url + '/images/loading.gif\" width=\"30px\" />');
$.ajax({
type: 'POST',
url: 'get_thread.php',
data: dataString,
success: function(result) {
$('#loading').hide();
$('.message_container').append(result);
}
});
return false;
});
Thanks for the help!
© Stack Overflow or respective owner