I need to add image tags to WP eCommerce’s Custom Meta fields but when I add it, it pulls it out as text. I would like to use Jquery therefore to find and replace the < > brackets so that it does render as an tag instead.
Here’s my source code:
<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>
Here’s how I think it should be working in jQuery:
jQuery(document).ready(function(){
// Remove "" from meta image
jQuery(".custom_meta").replace(/</g, '<');
jQuery(".custom_meta").replace(/>/g, '>');
});
Would this be the right way to replace the < to < and the > to >
?
Thank you.
This should do it
Read more at the documentation about
.html()