Reputation: 843
I have try to use jquery create a simple rich text,
$('#textarea').bind('keyup', function(e) {
var data = $('#textarea').val()
$('#data').html(data.replace(/\n/g,"<br />"));
});
$('#bold').click();
anyone know how to append text on select text inside of textarea(append front and back)
ex. append <b>
select text</b>
and don't show any tag inside of textarea <b>
Upvotes: 0
Views: 472
Reputation: 377
See my answer here on how to format selected text. Unfortunately, an HTML textarea component simply won't display HTML formatted text. You could certainly check out some HTML/JS rich text editor components such as TinyMCE instead of trying to write your own.
EDIT: You could apply my above answer to an editable div (or some other element that displays formatting) using @elclanrs link.
Upvotes: 1