【发布时间】:2021-08-10 10:10:50
【问题描述】:
我需要替换 noscript 中的值。
我尝试了以下代码,但它没有替换该值。
请告诉我如何修复代码?
我试过了:
jQuery("ls-slot-shortcode_actions a noscript").replaceWith("width=42");
现有代码:
<li class="ls-slot-shortcode_actions">
<a href="https://www.myhome.com">
<img scr="https://www.myhome.com/img/cco.png">
<noscript>
"<img width="18" height="12" class="ls-flag" src="https://www.myhome.com/img/cco.png" >"
</noscript>
</a>
</li>
谢谢。
【问题讨论】:
-
试试 jQuery(".ls-slot-shortcode_actions a noscript img").width("42");
-
您好:感谢您对 Kashif 的帮助。我试了一下,它添加了 style="width: 42px;",并没有改变 img 中的 width="18"。
标签: jquery wordpress replace default-value