Will Sumekar
Will Sumekar

Reputation: 1269

Is it possible to display ASCII characters in Javascript's pop up confirm() or alert()?

Is it possible to display characters like <, >, ', etc in Javascript's pop up alert() or confirm()?

< is automatically changed to &lt;

etc.

The same still occurs if I change the symbols to their unicode like < to \u003c etc.

Upvotes: 2

Views: 2289

Answers (4)

Artak
Artak

Reputation: 2887

This will work for you: \< or

\\>

Upvotes: 2

ControlPower
ControlPower

Reputation: 610

You could directly use alert("<") to display <. If not:

  1. the alert function has been over written, you could use alert(alert) to display the define.
  2. there is a bug in your browser.

Upvotes: 1

Rok Kralj
Rok Kralj

Reputation: 48755

Put your alert(); to external .js file. It should work fine.

Upvotes: 0

Manse
Manse

Reputation: 38147

Maybe its a browser problem / your code (ie how you are setting the string to be displayed) because it works fine for me - what browser are you using ?

http://jsfiddle.net/manseuk/uyMhJ/1/

Upvotes: 1

Related Questions