Replacing a custom tag to <br> - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:replaceWith

Description

Replacing a custom tag to <br>

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.0.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from w  ww .ja  va  2  s  .co  m
$(document).ready(function () {
    $("w").replaceWith('<br />');
    $("elp").wrap("<h1></h1>");
});
    });

      </script> 
 </head> 
 <body> 
  <elp>
    Hello world 
  </elp> 
  <w></w> 
  <elp>
    test test test
  </elp>  
 </body>
</html>

Related Tutorials