1
我需要添加图片标签到WP电子商务的自定义元字段,但是当我添加它时,它将其作为文本拉出。我想使用jQuery,因此查找和替换<>括号,以便它,而不是渲染为一个标签。找到< <使用jQuery
这里是我的源代码:
<div class="custom_meta">
<strong>CODE: </strong>JL16<br>
<strong>Colour: </strong><img src="http://localhost:81/live_products/shop/wp-content/uploads/blue.gif" /><br>
<strong>COLOURS: </strong>BLACK, WHITE, GREY, CORAL, BLUE<br>
<strong>FABRIC: </strong>LYCRA<br>
</div>
以下是我认为它应该是在jQuery的工作:
jQuery(document).ready(function(){
// Remove "" from meta image
jQuery(".custom_meta").replace(/</g, '<');
jQuery(".custom_meta").replace(/>/g, '>');
});
这将是更换<
到<和>
以正确的方式> ?
谢谢。
只是一个提示:'的jQuery(函数($){/ *现在使用$自由* /});' –