Skip to content

Instantly share code, notes, and snippets.

@piercemoore
Created January 21, 2013 23:04
Show Gist options
  • Select an option

  • Save piercemoore/4590353 to your computer and use it in GitHub Desktop.

Select an option

Save piercemoore/4590353 to your computer and use it in GitHub Desktop.
Increment Notification count
$(function() {
var badge_unreadMessages = $("#unread_message_count");
// Script to check for notifications runs
// If the script comes back with new notifications:
badge_unreadMessages.text( parseInt( badge_unreadMessages.text() ) + 1 );
});
<span id="unread_message_count">0</span>
@piercemoore
Copy link
Copy Markdown
Author

Then access the current count by

console.log( badge_unreadMessages.text() );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment