Mubeen Hussain Mubeen Hussain - 25 days ago 9
jQuery Question

Replacing text to bold in jquery

I am currently having a problem replacing current text with the same text but in bold. I have tried the following but not sure where i am going wrong:

var valueInRow = $(value).closest(".label.imaged").text();
var result = valueInRow.bold();
$(value).closest(".label.imaged").text().replaceWith(result);


Any ideas?

Answer

You can clearly use .wrapInner():

Wrap an HTML structure around the content of each element in the set of matched elements.

$(value).closest(".label.imaged").wrapInner("<strong />");
Comments