I have a text in a div. I can output the width of the div as below
alert($("div").width());
But I am interested in getting the width of the text inside it excluding the border or padding space. If I specify the font-family as arial or verdana then the space occupied by text will be different. So I want to know how is the width of just text.
Thanks
I set a span element around text and got exactly what I wanted.
Here is the code –
http://jsbin.com/oduvan/edit#javascript,html