 <p>This is a solution I got for you.</p> <p>Is that what you were looking for?</p> <p><a href="http://jsfiddle.net/migontech/YYWQx/6/" rel="nofollow">http://jsfiddle.net/migontech/YYWQx/6/</a></p> <pre><code>$.fn.stars = function() { return $(this).each(function() { // Get the value var val = parseFloat($(this).html()); // Make sure that the value is in 0 - 5 range, multiply to get width var size = Math.max(0, (Math.min(5, val))) * 16; // Create stars holder var $span = $('&lt;span /&gt;').width(size); // Replace the numerical value with stars $(this).html($span); }); } $(function() { $('div.star-rating strong').stars(); }); </code></pre>