Global.unescape()

JavaScript 1.0+, JScript 1.0+, ECMAScript 1.0+ Nav2+, NES2+, IE3+, Opera3+ Syntax

unescape(string)

Description

The unescape() method takes a hexadecimal value and returns the ISO-Latin-1 ASCII equivalent. This method performs the opposite operation of the escape() method and is commonly used to escape user-entered data before form submission.

Example

Listing 6.142 declares a local variable, escapedVal and passes it to the unescaped() method. The result, "@", is then written to the page.

Listing 6.142 Using the unescape() Method to Convert a Hexadecimal Value to Its ASCII Equivalent
 <script language="JavaScript"> <!–– Hide // create a variable var escapedVal = "%40"; // evaluate the variable and place the value in a ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.