I am wanting to add a style (bold and blue for example) to every instance of a word or words on my website. Is this possible with jQuery? And how would I write it?
Use a jQuery command to style the words “Company” into “Company” (bold and blue).
I’m afraid it would not be straightforward.
To style text it would first need to be enclosed with a <span> tag.
There is no selector to do what you want so you are in to traversing the DOM to locate occurrences and then manipulating the html within it.
The .text method returns the text within an element that includes any elements it contains. So for example $(“body”).text() should return the whole text of the document.