我正在尝试替换以下代码中的 CSS 样式:
var theHTML = this.html();
theHTML.replace("style=\"display:none;\"", "style=\"display:inline;\"");
alert(theHTML);
html 看起来像这样:
<IMG SRC="picturesFromServer.asp?PhotoId=365481" style="display:none;">
然而,一旦我检查它是否改变了它,它就会一直显示无而不是内联。我只是想让它在打印之前可见。
最佳答案
你可以使用 JQuery 的 .css()
方法:
$("img").css("display","inline");
关于javascript - jquery 替换 html() 中的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9510485/