Regular expressions are a right way to validate text fields such as email addresses, phone numbers, names, age, date and other input information.
Continue reading “How to validate email address in JavaScript”
Category: Java Script and jQuery
How to validate phone number in JavaScript
Regular expressions are a right way to validate text fields such as phone numbers, names, addresses, age, date and other input information. You can use them to constrain input, apply formatting rules, and check lengths.
Continue reading “How to validate phone number in JavaScript”
Dense Arrays in JavaScript
A dense array is an array that has been created with each of its elements being assigned a specific value.
Dense arrays are used exactly in the same manner as other arrays. They are declared and initialized at the same time.
Continue reading “Dense Arrays in JavaScript”
Conform Dialog Box in JavaScript
Confirm Dialog box serves as a technique for confirming user action. In JavaScript Confirm dialog box display these information:
Continue reading “Conform Dialog Box in JavaScript”
Prompt Dialog Box in JavaScript
Suppose you want to require user interaction on the webpage for example if you want to display a dialog box that has some predefined message, a textbox that accepts user input and Ok and cancel button then we can use prompt dialog box in JavaScript.we know that Alert dialog box simply dislays information in a browser and does not allow any user interaction.
In prompt dialog box if user click on ‘Ok’ button then text types inside the textbox will be pass to the program environment otherwise if user click on ‘Cancel‘ button then it return null to the environment.
Prompt() method requires two blocks of information:
A message to be displayed as a prompt to the user
Any message to be displayed in the textbox, this is optional.
we can use Prompt() in JavaScript as:
prompt(“message“,”default value“)
Example:
<html> <head> <title>example</title> </head> <body> <script language="javascript"> document.write("<H1>Welcome,"); document.write(prompt("Please enter your name :"," Name")); </script> </body> </html>
Alert Dialog Box in JavaScript
Dialog box in java script appears as separate window and their content depends on the information provided by user. Java script provide the Alert dialog box that can be used to display the string message or display some information.
Continue reading “Alert Dialog Box in JavaScript”
Array in JavaScript
In javaScript array is the object that is capable of storing a sequence of values. These values are stored in indexed locations within the array. Number of elements in Array is called by length of array.
Continue reading “Array in JavaScript”
See Passwords Behind Asterisks
This is one of the coolest trick which you can perform using Javascript. This trick will allow you to view passwords behind Asterisk.
You can use this trick on any web page which contains password hidden behind Asterisk.
To view saved passwords behind asterisk, Continue reading “See Passwords Behind Asterisks”
The Strict Equality Operators
JavaScript introduces two new operators, the strict equality operators.
The strict equality operators (=== and !==) perform equality comparisons on operands of the same type. No type conversion is performed before the comparison. They should be both Integer, String, or any other JavaScript type:
operand1 === operand2
operand1 !== operand2