Main > Free JavaScripts >

Accept terms & conditions script
Add an "Accept Terms & Conditions" clause to your form with this script. With it, users must explicitly signal their acceptance of your terms/conditions (by checking a box), before he/she can submit the form. Very useful script.

Auto clear form elements
If you have forms on your page that contain default text in them, this is a great time-saving script that makes life easier for your visitors that have to fill them out. The script automatically clears the default text inside the containing form element when the user sets focus on it, so the user can just aim, focus, and starting typing. Cool!

Auto tab (form field) script
This script "auto tabs" a form field (and jumps to another field) once the length of the field's value has exceeded a certain length. It works in conjunction with the "maxlength" attribute of HTML, triggered whenever the user's input reaches the maxlength's value.

Block multiple form submission
This useful script prevents a form from being inadvertantly submitted more than once, which often occurs if the user clicks on the "submit" button multiple times before the process is complete. The result is partial or multiple submissions. With this script, the submit button is disabled once it's been pressed the first time.

Character count
Calculate and display the number of characters within a TEXTAREA with this script. Useful, for example, in helping your visitors manually keep their input length in check!

Check all check/radio buttons
A good addition to your forms if they contain a multitude of check/radio buttons is a "check/uncheck all" feature. This script does just that for any group of checkboxes and radio buttons.

Check if its a number
This script checks the contents of a form box to ensure that its a number. If not, the submission of the form is canceled, and the surfer prompted to re-enter a valid number.

Check required elements
This is an easy-to-setup form validation script that allows you to specify certain form elements as "required". When the surfer submits the form, the script checks these elements to make sure that are NOT empty before allowing the form submission to proceed. Before, this work was usually handled by a CGI script; this is a JavaScript that essentially performs the same task.

Clear default form value script
Use this practical script to automatically clear the default value of any form's input field when the mouse sets focus on it. We use something very similar here on JavaScript Kit to clear the default value of the search box (see frontpage) when the user interacts with it. Cool and practical a script it is!

Current date in form script
If you have a "Today's Date" field in your form, why not let JavaScript automatically fill it in for your visitors? Easily configurable to show the date in desired order of month, day, and year.

Double-enter form field script
Make sure an important field within your form is filled out correctly, by requiring that the user fill it out twice.

Drop down date select
This script displays the current date inside a form via 3 prefilled drop down menus (day, month, year). The visitor can then specify a different date if he/she wants. You can have multiple drop down dates within the same form as well.

Editable Select box
Make any select box on your page editable using this script! Extremely easy to install, your select box's option values can now be modified by the user.

jQuery MaxLength for INPUT and TEXTAREA fields
This useful form validation script lets you add a custom "maxlength" attribute to INPUT type="text" and TEXTAREA elements, so users are prevented from entering more characters into these fields than the designated number. It can optionally show the number of characters remaining for a field as the user types while displaying this info in different colors depending on how close the user is to the limit.

Form2Popup script
This useful script allows you to target a form's submission to a new window, so the original page does not change once the "submit" button is pressed. Instead, a customizable pop up window is launched containing the destination page. Very cool!

Form Field hints
Provide helpful hints alongside certain form fields to guide your users on  how to fill them out with this elegant script. A hint pops up only when the field is question has the user focus.

HTML to Entities (form) script
This script converts special HTML characters to their entities version inside user entered data such as a TEXTAREA before the form is submitted. Characters converted include "<", ">", quotes, and "&".

Limit number of checked checkboxes script
This short but practical script lets you limit the number of checkboxes within a group that can be checked. For example, you may have a list of 5 checkboxes, but wish to allow the user only the ability to check a maximum of 2 at any time. Use this script to accomplish that.

Max # of characters check
A script that checks the number of characters in a form box, and if it exceeds the predetermined number, cancels the form submission, and asks the surfer to re-enter data.

Max # of words check
A script that checks the number of words in a form box, and if it exceeds the predetermined number, cancels the form submission, and asks the surfer to re-enter data.

Parse number to currency format
This is a handy script for forms that contain money values. It automatically parses the form element of your choice whenever a surfer enters a number into the standard currency format; In other words, a number in two-decimal format, with an optional dollar sign in front.

PickList script
PickList creates two form selection fields, and allows the user to easily transfer items from one field to another via "back" and "forth" buttons. Copy multiple selections at once by holding down the Ctrl button.

PickList II script
Like above, this JavaScript moves form elements from one select box to the other. It allows for multiple items to be moved at once, and all items are sorted alphabetically as they are moved. The items are sorted by their description, not their value, which is helpful when pulling items from a database which have random IDs associated with them.

Remember Text field values
Certain form fields always contain the same values, such as your user's name, email address fields etc. This script will remember the values entered into these fields, and automatically fill out these fields the next time the user returns.

Rescue Text and TEXTAREA field values script new01.gif (1016 bytes)
One of the worst things that can happen when a user is entering data into an INPUT type="text" or TEXTAREA element is an accidental browser reload or even crash- all the data is instantly lost. This script uses HTML5's sessionStorage to store the text entered into these fields as the user types, and recalls them in an event of a page refresh or even browser crash (FF3.5+ only).

Select-all form element script
This script allows you to add a "select all": feature to your form <textarea>s, whereby visitors can easily highlight the containing content with a click on a link. Highly requested.

Select-all form element script II
Version two of the Select-All form element script, this one highlights the content of the specified form element as soon as the mouse sets focus on it.

Strip HTML tags (form) script
This script removes any HTML tags from user entered data such as a TEXTAREA before the form is submitted. This is generally a good idea, as HTML tags can corrupt the rest of your form contents or even pose a security risk.

Tell-a-friend script
Let visitors refer others to your webpage (via email) with this script! It asks for the friend's email address, then loads the email program with the essential information pre-filled to instantly send off.

Validate Date field script
This script validates a date field to ensure it's in the format mm/dd/yyyy. It also intelligently checks that the date ranges are valid, so something like 02/30/2005 is caught.

Word Count
Often times when filling out a form, certain fields are restrictive of the number of words you are allowed to enter into it (such as the description field when submitting your site to search engines). How many times have you had to launch an entire word processor just to find out the # of words a certain paragraph contains? Why not use this script instead?

JavaScript Tools:
Site Info

CopyRight 1998-2012 JavaScript Kit. NO PART may be reproduced without author's permission.