Created
March 13, 2012 21:03
-
-
Save eveevans/2031570 to your computer and use it in GitHub Desktop.
jquery extension for split element words into span
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
/*! split_in_span v1 | flasheves.com */ | |
jQuery.fn.extend({ | |
split_in_span: function(){ | |
var arr = jQuery(this).text().split(' '); | |
var tamo = arr.length; | |
for(i=0;i<tamo;i++){ arr[i] = '<span>' + arr[i] + '</span>'; } | |
jQuery(this).html(arr.join(' ')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment