I want to hide a label using the fadeOut effect but when it is completed I want to insert inside it a
$('label.alert').fadeOut('slow',function(){$(this).text(' ');});
but it produces a as a raw text. Any ideas ?
I want to hide a label using the fadeOut effect but when it is completed I want to insert inside it a
$('label.alert').fadeOut('slow',function(){$(this).text(' ');});
but it produces a as a raw text. Any ideas ?
使用.html()而不是.text().
.html()使用或使用其他框架/库(例如v-html在 Vue.js 中)的相同方法时要小心,因为它具有 XSS 漏洞。从此答案中阅读有关 XSS 的更多信息。
通过 .text() 的工作方式:
您可以简单地替换 为\xa0文本消息。
replaceWith成功了
$('label.alert').fadeOut('slow',function(){$(this).replaceWith('<label class="alert"> </label>');});