String.toLowerCase()

JavaScript1.0+, JScript1.0+, ECMAScript1.0+ NES2+, Nav2+, IE3+, Opera3+ Syntax

							string.toLowerCase()

Description

The toLowerCase() method of an instance of a String object converts the characters in that string to all lowercase values. This is often used when a programmer is trying to evaluate a string a user has entered and does not care about case.

Example

Listing 6.257 pops up a prompt box and asks the user to enter various case text. After the user clicks OK, the lowercase version of the string is written to the page.

Listing 6.257 Using the toLowerCase() Method of the String Object to Convert a String Entered by a User to Lowercase
 <script language="JavaScript"> <!–– Hide // Create an instance of the String ...

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.