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/

http://api.jquery.com/replacewith/


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -