开发者_高级运维I need to highlight the text that I prepend; not the entire string. My code below highlights everything.
jQuery("#foo").prepend("<li>Addition li</li>").effect("highlight", {}, 1000)
So I only want to highlight that new
Use prependTo()
and go the other way instead of prepend()
:
$("<li>Addition li</li>").effect("highlight", {}, 1000).prependTo("#foo");
or you may want to prepend first:
$("<li>Addition li</li>").prependTo("#foo").effect("highlight", {}, 1000);
Identify the prepended text with a class and style it in your css? This may or not be suitable depending on your requirements, but i'd say its the simplest approach.
精彩评论