How can I find the width of an element in JavaScript/jQuery without counting the part that is trailing whitespace. The result for the example below would be 16px because it is only one character, and the font size is 16px.
<div class="styled"
style="width: 1024px; margin: 5px; border: 10开发者_如何学运维0px solid lemonchiffon;">
0
</div>
$("#whateverYourDivIs").children().width()
?
Since you want to get at only the text, get the computed width of the text node inside the div
精彩评论