Created
February 16, 2014 23:26
-
-
Save birkof/9042142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Addition to jQuery to get the inner text width | |
$.fn.textWidth = function(){ | |
var text = $(this).html(); | |
$(this).html('<span>'+text+'</span>'); | |
var width = $(this).find('span:first').width(); | |
$(this).html(text); | |
return width; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment