I have a function
$(document).ready(function () {
$("#btnhighlight").click(function () {
var htext = $("#txthighlighttext").val();
$("#lstCodelist option").each(function () {
var sp = $(this).text();
var sp1 = sp.split(' ');
$.each(sp1, function (i, l) {
if (l == htext) {
var boldText = "<div style=\"background-color: yellow; display: inline; font-weight: bold;\">" + htext + "</div>";
$(document).append(boldText);
}
});
});
});
});
I updated the code but no luck. Here in this code I need to create a l has a DOM element to apply color yellow to that.
please can any body help me out how to create a dom element.
Thanks
<span>around each word, and for that, this jQuery forum post might help.