Skip to content

Instantly share code, notes, and snippets.

@Scordavis
Created April 27, 2017 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scordavis/45e8bc58287f821f3b2a3ef125ce0c13 to your computer and use it in GitHub Desktop.
Save Scordavis/45e8bc58287f821f3b2a3ef125ce0c13 to your computer and use it in GitHub Desktop.
Wrap first letter of Sentence in tag (span) with class
$(function(){
var a = new String;
a = $('.section-heading').html();
var b = a.indexOf(' ');
if (b == -1) {
b = a.length;
}
$('.section-heading').html('<span>'+a.substring(0, 1)+'</span>'+a.substring(b, 1)+a.substring(b, a.length));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment