Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Created September 7, 2018 10:29
Show Gist options
  • Save Farmatique/c8a0c03e32814ce4abe7eb43efd0deac to your computer and use it in GitHub Desktop.
Save Farmatique/c8a0c03e32814ce4abe7eb43efd0deac to your computer and use it in GitHub Desktop.
Wrap first letter in a word
$('p').html(function(i, html){
return html.replace(/^[^a-zA-Z]*([a-zA-Z])/g, '<span class="first-letter">$1</span>');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment