Javascript examples for jQuery:Image
take div and convert it to img tag using jquery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.2.js"></script> <script type="text/javascript"> $(window).load(function(){/* w ww . ja v a 2 s. c o m*/ $(function(){ $('div').each(function(){ $img= $('<img>').attr('src','http://www.java2s.com/style/demo/Opera.png'); $(this).replaceWith($img); }); }); }); </script> </head> <body> <div> test </div> </body> </html>