Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我在整个站点中使用Gritter进行通知,并且想知道是否有一种简单的方法可以使用 jQuery 插入任何脚本抛出的所有 alert() ,并将警报的值重新格式化为 Gritter 的主体通知?
您可以替换该alert函数并使用参数做任何您想做的事情:
alert
window.alert = function (message) { $.gritter.add({ title: 'Message for you sir!', text: message }); };