I am having a problem with a link that is appended to the page when a new message is available. It acts like a link when hovered over but fails to fire when clicked.
var data_split=data.split("*^*");
var count=$('.n_1').length;
if(parseInt(count)!=parseInt(data)) {
var new_messages=parseInt(data)-parseInt(count);
if(new_messages!=0) {
$('.message_update_holder').html(
"<p><a class='center n_message' href='javascript:void(0);'>"
+new_messages+" new notifications.</a></p>");
}
} else {
return;
}
To fire the click event my code is as follows
$(document).on('click', '.n_message', function(){
get_notifications();
});
It should be noted that the first part of the code is loacted in a function that updates every 10 seconds. I have tried clearing the html from message_update_holder on every update but this did not seem to work.