如何更新材料设计lite徽章计数



如何用javascript更新Material Design Lite徽章上的数据徽章计数?例如,从数据库获取通知后,通知徽章上的新通知数。

在Javascript中找到解决方案:

let element = document.getElementById("#yourBadgeId");
element.setAttribute("data-badge" , yourValue);

确保在html脚本中,mdl徽章标记不应包含数据徽章属性

最新更新