Replace div with a particular class with editable textarea - Javascript jQuery

Javascript examples for jQuery:Form Textarea

Description

Replace div with a particular class with editable textarea

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://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w w  w . j  av a 2  s. c  o m*/
$('div').replaceWith(function () {
    return $('<input />').addClass($(this).attr("class")).val($(this).text());
});
    });

      </script> 
 </head> 
 <body> 
  <div class="divclass">
    "Same text" 
  </div>  
 </body>
</html>

Related Tutorials