Created
October 31, 2014 12:33
-
-
Save HeikoMamerow/b9366983d118c72fd294 to your computer and use it in GitHub Desktop.
Mark first character of each word
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
function first_character() { | |
var str = document.getElementsByClassName("text") | |
for (var i = 0; i < str.length; i++) { | |
str[i].innerHTML = str[i].innerHTML.replace(/\b[a-z0-9]/gi, "<span class='first-char'>$&</span>") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment