Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print <DummyText> inside html tag using javascript?

Tags:

html

I need to show "<>" symbols for my string "DummyText". When i run and inspect the element, it converted to be DOM element in HTML like . This is the code I am trying to do

<p><a href='' title='Survey Link'><DummyText></a></p>
like image 457
Dhya S Avatar asked Feb 13 '26 23:02

Dhya S


2 Answers

Use &lt; and &gt; instead, from here

<p><a href='' title='Survey Link'>&lt;DummyText&gt;</a></p>
like image 134
Carl Binalla Avatar answered Feb 16 '26 14:02

Carl Binalla


For HTML you have to encode special characters:

<p><a href='' title='Survey Link'>&lt;DummyText&gt;</a></p>
like image 29
Pavel Avatar answered Feb 16 '26 16:02

Pavel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!