I am trying to add rich fragments to a dynamic image that displays stars. The only thing my basket writes is the image, so I have to find which image is displayed, and then add the correct meta tag.
So, if the displayed image is 1stars.gif, I have to write:
<meta itemprop="ratingValue" content="1" />
and if the displayed image is 5stars.gif, I have to write:
<meta itemprop="ratingValue" content="5" />
The following is the UPDATED full example:
<span id="rateitnow"> {module_ratingrank,images/icons/stars} <meta itemprop="ratingValue" content="" /> </span> <script type="text/javascript"> jQuery(document).ready(function($) { $('#rateitnow meta').attr('content', $('#rateitnow').find('img:first').attr('src').substr(0,1)); }); </script>
source share