Created
May 7, 2017 09:35
-
-
Save AntonLitvin/4e5db5d28b1fc3da5d8f3ff8f47dcd2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//span around last word | |
$('.sentence').each(function(){ | |
var self = $(this); | |
self.html(self.html().replace(/(\S+)\s*$/, '<span>$1</span>')); | |
}); | |
//span around first word | |
$('.sentence').each(function(){ | |
var self = $(this); | |
self.html(self.html().replace(/^(\S+)/, '<span>$1</span>')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment