I need to change text inside html tags, using jQuery/javascript.
For example, I need to change this:
<a id="id_1" href="www.google.com"> TEST </a>
into this:
<a id="id_1" href="www.google.com"> SUCCESS </a>
This should be done in regular time intervals, through a jQuery function, but that timing part I know how to do – I just don’t know how to change this text. Any help is welcome, since this is the first time I am trying to do something like this.
EDIT:
Sorry for what seems to be a stupid newbie question everyone. I have tried searching online, but whatever I typed in gave me results such as changing field values, or element attributes. I will choose the first answer, and once again, sorry for the question.
If you look at the jQuery API documentation, you’ll see a function called
jQuery(also usually$) that can find elements based on a CSS selector, and another calledhtml. You can use them to do this.If you take an hour to read through the API docs (it really only takes that long), you’ll find a lot of very useful information there. Also consider reading up on the DOM (Document Object Model), which jQuery uses to perform (most of) its work. Various DOM documents can be found on the W3C DOM page.