jquery - Find img tag and replace with another tag -
how can find img
tag , replace span
tag using jquery?
<style> .box{ display:inline-block; width:100px; height:20px; line-height:20px; font-size:11px; } </style> <p id="recommend"> <img src="search.gif" alt="find"> <!-- find img tag without id , class--> </p> <!-- next --> <p id="recommend"> <span class="box">search</span><!-- replace --> </p>
you can use jquery's replace()
or replacewith()
methods achieve trying.
here links usage:
https://api.jquery.com/category/manipulation/dom-replacement/
Comments
Post a Comment