How can I update the data-badge count on a Material Design Lite badge in javascript? For example, the count of new notifications on a notification badge after fetching the notifications from the database.
Asked
Active
Viewed 105 times
-2
-
I suggest you to search Asp.Net Signalr so that the numbers in the notification section can work synchronously with the database. similar example https://stackoverflow.com/questions/53901043/push-notifications-with-signalr – Önder Fatih BUHURCU Aug 25 '20 at 09:49
1 Answers
0
Found the solution in Javascript:
let element = document.getElementById("#yourBadgeId");
element.setAttribute("data-badge" , yourValue);
make sure that in the html script, the mdl badge tag should not contain the data-badge attribute

James Gitonga
- 101
- 2
- 10