Reputation: 510
I am using markItUp editor in my webpage and I wanted to do on the fly editing to authorized users. When user double click to post Jquery turns div into textarea and
#textarea.markItUp();
converts the textarea to markitup editor. However my problem is post has too many < p> tags and when I convert div into textarea it ends up like this : http://jsfiddle.net/D3v7F/ (click change)
But I want to show < p> as new paragraph. how to achive this ? and < strong> tags into [b]strong's inner text[/b]
Upvotes: 1
Views: 1258
Reputation: 17370
Try this instead:
$('#submit').click(function(e){
var html = $('.change p').html();
$('.change').replaceWith('<textarea>'+html + '\r\nNew paragraph</textarea>').html().focus();
});
JSFiddle: http://jsfiddle.net/D3v7F/3/
Upvotes: 1