1

I am doing a chat application. In that when I posted a html code it gives HTML executed out put

For Eg if I posted as:

<i><h1>welcome</h1></i>        

it gives out put as

welcome

but I need my out put same like as input. The actual output should be

<i><h1>welcome</h1></i>

Could any one help me plz.. Thanks advance,,,

imran
  • 39
  • 1
  • 5

2 Answers2

2

you should use pre tag :-

<pre><i><h1>welcome</h1></i></pre>

Link

Mukul Kant
  • 7,074
  • 5
  • 38
  • 53
0

$("div").text("test"); this is what you looking for.

You can use .text() to escape html characters.

Ahmet Can Güven
  • 5,392
  • 4
  • 38
  • 59