javascript - HTML: stop rendering HTML code inside div -
this question has answer here:
- preview html markup inside textarea 1 answer
if write below inside textarea
<strong>test</strong>
inside textarea , display inside div. shows text in bold letter instead of showing html code is. how can avoid rendering html code. want show text entered user.
you haven't shown code, since have tagged jquery
i'll assume have like:
$('div').html( $('textarea').val() );
use text
method instead, user has typed treated text instead of html.
$('div').text( $('textarea').val() );
see a demonstration.
Comments
Post a Comment