javascript - HTML: stop rendering HTML code inside div -


this question has answer here:

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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -