Using jQuery, select first word of element and alter css -


i've seen lot of examples of how take first word of element , add span around it, giving element new class can alter in css, have not been able figure out how alter css directly in jquery.

i'm using code span thing right now:

$("h1").html(function(i, text){   return text.replace(/\w+\s/, function(match){     return '<span class="first_word"> + match + '</span>; }); }); 

i'm trying make first word of titles new color , font-family. works h1, have widget title h3 displays added span in plain text when add selection. want change css of first word instead of adding span. (i have no idea "/\w+\s/" doing explaining added bonus :) )

thank wise ones!

there first-letter , first-line pseudo element there no first-word. need span.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -