jquery form validate not allow space for username field?

后端 未结 7 1202
别那么骄傲
别那么骄傲 2020-12-17 14:43

I have used http://bassistance.de/jquery-plugins/jquery-plugin-validation/

my form validate :

$(\"#form_person\").validate({
    rules: {


        u         


        
7条回答
  •  半阙折子戏
    2020-12-17 15:14

    Since jquery-validation 1.15.0 a cleaner approach is to use the normalizer callback:

    $( "#myform" ).validate( {
      rules: {
        field: {
          required: true,
          normalizer: function( value ) {
            return $.trim( value );
          }
        }
      }
    } );
    

    The normalizer (immutably) transforms the value before the validation takes place.

    See the Normalizer Docs for more details.

提交回复
热议问题