Wednesday, 14 August 2013

how to add style to span like .attr('style', 'width:newWidth '); where newWidth is dynamic

how to add style to span like .attr('style', 'width:newWidth '); where
newWidth is dynamic

I have a code like below
var newWidth = Math.floor(width * .75) + 'px';
$(this).find("input:first").attr('style', 'width:newWidth ');
could you please correct me as what should be the right syntax as passing
newWidth directly is not working also I have to do this via style only

No comments:

Post a Comment