[jQuery] Am I missing something?
<!-- Before bargraph plugin is applied -->
<div class="graph">
22
</div>
<div class="graph">
89
</div>
<!-- Fairly basic function -->
jQuery.fn.bargraph = function() {
return this.each(function(){
var temp = $(this).text();
var span = '<span>' + temp + '%' + '</span>';
var bar = '<strong class="bar"></strong>';
$(this).html(span);
$(this).find('span').wrap(bar);
$(this).find('strong').width(temp+'%');
});
};
<!-- What I end up with -->
<div class="graph">
<strong class="bar" style="">
<span> 22 %</span>
</strong>
</div>
<div class="graph">
<strong class="bar" style="">
<span> 89 %</span>
</strong>
</div>
Why is width never applied?
I've tried stringing it together as well with the same result.
Any ideas?