Number & Date Validation with JavaScript Examples

Auto validating with "class" attribute

This class uses class attributes to make fields able validate.
Use validatenum to make validation if field is number with validatenum  you can use also nominus to block negative numbers ("-" sign), nodecimal to block decimal numbers and thousand to put thousand separators after blur action.
You can use also validatedate className to validate dates.

You should replace variables:

var date_seperator = '-';
var decimal_seperator = ',';
var thousand_seperator = '.';
 class="validatenum nominus thousand nodecimal" 
(Type Something to test)
 class="validatenum nominus thousand" 
(Type Something to test)
 class="validatenum thousand" 
(Type Something to test)
(Type Something to test)
(Type Something to test)


onkeypress="return K_Validate.checkNum(event)" 
(Type Something to test)