Adding a new event handler does not remove the event handlers you already have, so the default action is still prevented.
Use on()
and off()
instead
if ($.trim($('a#full_notifications_link').text()) == "No New Notifications"){
$('a#full_notifications_link').on(function(event){
event.preventDefault();
});
}
$(document).ajaxComplete(function(){
if ($.trim($('a#full_notifications_link').text()) == "See All Notifications"){
$('a#full_notifications_link').off('click');
}
});
It does seem easier to just check the text inside the event handler
$('a#full_notifications_link').on('click', function(e) {
if ( $.trim($(this).text()) == "No New Notifications"){
e.preventDefault();
}
});