How to validate Date using Javascript Regular Expression
Here is a simple Javascript function to validate a date in US format.
Here is a simple Javascript function to validate a date in US format.
It is amazing that many web developers still use onload method embedded in the BODY tag, like <HEAD> <BODY onload=”document.contact.userID.focus();”> <form name=”contact”> <input type=”text” name=”userID” > </form> </BODY> </HEAD> There are two problems with this line of code. Embedding code (behavior) with HTML (structure) makes it difficult to maintain the page. onload() method will executes […]
Almost all major web development projects include some javascript. Developing Javascript may be easy for some but working around various browsers’ incompatiblities makes it a bit more tedious chore. As a developer I always welcome the opportunity to use development tools that may help in the development process. Following is a list of some useful […]
Image credit:Kyle Wegner OK, admit this. You have a nice-looking website. The color and the graphics look pleasing to visiting eyes. But you do not get a lot of loyal visitors. The problem may not be your design, it may be the static content that is turning the visitors off. If you do not update […]
Image credit: aussiegall Continuing with our JavaScript regular expression series today we will discuss JavaScript regular expression to validate U.S phone numbers. Previously we talked about validating email, Social Security number, and zip code using JS regex. I’ll show you how to use regular JavaScript expressions to validate U.S. phone numbers in today’s post. Although […]
Continuing with my series of JavaScript regular expression today we will see how easy it is to validate zip code using regular expression in JavaScript. Previously we talked about validating email and Social Security number using JS regex. In today’s post, I’ll show you how to use JavaScript regular expression to validate zip code. Let […]
When I wrote the JS regular expression article last week I had no idea that it will attract so many visitors. Not only did so many people read this post, many more visited my blog searching for other regular expressions. So I decided to write few more posts about JavaScript regular expressions and how to […]
Last month I wrote about regular expressions in Java, today I’ll show you how to use regular expression in JavaScript to validate email address. Here is the code to validate email address in JavaScript using regular expression. function validateEmail(elementValue){ var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailPattern.test(elementValue); } Explanation: The argument to this method is the email […]
A HTML form is a very good channel that you can offer to your visitors to contact you. An aesthetically appealing form encourages user to fill and submit it. It is equally important to make the form as user friendly as possible. Today I’ll share a small JavaScript function that will set the focus on […]
Sorting an array in Javascript is a snap. You create an array and then call sort() method on that array. The Javascript sort() method sorts an array in lexicographical order. This method is very useful in sorting alphanumeric values of an array. However, sort() will not work if the array consists of numeric values. Because […]