I have this :
<div class="blog-page-nav-previous">
<a href="my-link" class="blog-link"><<Previous</a>
</div>
I’m trying to find all instances of the class blog-page-nav-previous
and replace the text inside the <a>
tag: <<Previous
with an image of my own.
How do I do that?
4
Answers
This should work:
If you want the image to have keep the same link as what "Previous" is set as, change the getElementByClassName to look for "my-link" instead of "blog-page-nav-previous"
You could try this
If you are trying to only replace the contents of the element you could replace a.outerHTML with a.innerHTML
Since you’re asking for a jQuery solution:
I think you want the image to work as a link, if yes then I have a solution for you
This should work and sorry if this is not the answer you want