I have a variable hard coded in to my html inside script tags like this(it calls meta information from a wordpress post and I’ve checked that the meta is being pulled)
<script type="text/javascript">
var jg_product_price = "<?php echo get_post_meta($post->ID , 'productprice' , true); ?>";
</script>
my jquery code reads;
.prepend('<span>'+jg_product_price+'</span>');
the html output is:
<span></span>
i.e an empty span
Is it something to do with the “‘” in the var jg_product_price? Many thanks
It looks like
jg_product_priceis empty. Have a look ator view the source code of the page. Make sure
get_post_meta($post->ID , 'productprice' , true);is not empty.