Monday, June 15, 2015

Rendering HTML tags inside textarea




In textarea
  var $mailform = $('<textarea id="textbody"><textarea>');
   $mailform.find('#textbody').html("Dear <br />, This is advised that...");
We found html tags br is not rendered.

To sovle this problem, we make a div editable
  var $mailform = $('<div id="textbody" class="editable"><div>');
   $mailform.find('#textbody').html("Dear <br />, This is advised that...");
   $('.editable').each(function(){
                 this.contentEditable = true;
    });

Now this div has same feature as textarea.

No comments:

Post a Comment