No decimal numbers jquery validation

on with Leave a reply

JQuery validation plugin is widely used in web applications for inline form validations. When I came  across the number method validation, it allows the decimal number. but I had situation to allow only non decimal number in some form fields. Fortunately, jquery validation allow us to extend the custom method. So I created below method to validate decimal numbers. Hope it will help some one looking for the same!

	$.validator.addMethod("noDecimal", function(value, element) {
		return !(value % 1);
	}, "No decimal numbers");
Posted on by .

About Gowri

I am professional web developer with 8+ years experience. PHP, jQuery, WordPress, Angular and Ionic are my key skills in web development. I am working with strong enthusiastic team with spirit. We provide all web related solution like HTML/CSS development, Web graphic design and Logo.

Leave a Reply

Your email address will not be published. Required fields are marked *