ok guys I have this code
var text = $('.css .cont_code code');
text.contents().text(function() {
$(this).each(function() {
var cssC = "background , background-color , width , height , float , margin , margin-left , margin-right , margin-top , margin-bottom , contents , border , !important"
if (text === "cssC")
{
$(this).wrap('<span class="stylesC" />');
}
})
})
Its grabbing all the text node lines, just not the text I am providing in the var cssC = code any help would be greatly appreciated never grabbed textNodes with jQuery and know very little on how to write actual javascript like getElementById i’m not fluent at that nor jQuery really to be honest.
Basically what I am trying to do is grab the certain text fields I place in the var cssC then if it is found to wrap that in a span with span class="stylesC" /> The out come should look like this
http://jsfiddle.net/YxjnR/1/
You don’t have to do much jQuery work here, but I would split the words in
cssCand then just do a replace on the html string when you find those words with the same string wrapped in a span.