Return to Snippet

Revision: 49887
at August 1, 2011 17:15 by mantosz


Initial Code
$(document).ready(function()
	{
   	// Add Method too jQuery Validator
    jQuery.validator.addMethod("noSpace", function(value, element)
    	{ return value.indexOf(" ") < 0 && value != ""; }, "No space please and don't leave it empty");
	// Apply to jQuery Validate rules 
    $("form").validate({
        rules: {
            name: { noSpace: true }
        }
    });
})

Initial URL
http://stackoverflow.com/questions/2942325/jquery-form-validate-not-allow-space-for-username-field

Initial Description

                                

Initial Title
jQuery Validator Extension: No Space

Initial Tags
validation, extension

Initial Language
jQuery