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 = $(\'.c
$.fn.textWidth = function(){ var w = $('body').append($('')).find('#textWidth').html($(this).html()[0]).width(); $('#textWidth').remove(); console.log(w); return w; };
almost a one liner. Gives you the with of the first character