Thursday, 13 March 2014

How to print html tags as plain text in html page using javascript 0

In this post i'm going to share how to print html tags as plain text in html page using javascript.

browser read < (greater than) and > (lesser than) symbols as for html tags. So, if we use these symbols in plain text, browser will consider it as a html tags.

So we need to replace < with & l t ; and >with & g t ; to print HTML tags as a Plain Text.

If you feel hard to write your code with these changes, leave it. Use this below javascript function to convert html tags to plain text.

Here is the javascript function

HERE YOU CAN FIND THE DEMO

0 comments:

Post a Comment