calculating text width with jQuery
Posted
by Dom
on Stack Overflow
See other posts from Stack Overflow
or by Dom
Published on 2009-10-17T16:09:31Z
Indexed on
2010/05/05
8:28 UTC
Read the original article
Hit count: 96
jQuery
Hi.
I'm trying to calculate text width using jQuery. I'm not sure what, but I am definitely doing something wrong.
So, here is the code:
var c = $('.calltoaction');
var cTxt = c.text();
var cWidth = cTxt.outerWidth();
c.css('width' , cWidth);
Thank you for your help in advance!
© Stack Overflow or respective owner