Replace text with : replaceWith « jQuery « JavaScript DHTML






Replace text with

     
<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
              $("p").replaceWith("<div>" + $(this).text() + "</div>");



        });
    </script>

    <style>
      div { border:2px green solid;}
    </style>
  </head>
  <body>
    <body>
       <p>Hello</p>

    </body>
</html>

   
    
    
    
    
  








Related examples in the same category

1.Replace with another tag
2.replaceWith(content): Replaces all matched elements with the specified HTML or DOM elements.
3.Replace a button with text
4.Replace all with