JQuery. validate does not support solutions in ie8-floating leaf

Source: Internet
Author: User
JQuery. validate does not support solutions in ie8-float leaf 1 and problematic code in ie8

1. The JQuery. validate verification framework is submitted and verified through the form on the page.Whether the tag matches your own rules

1
 
  
2
  
 
  
   
3
   
  
    4 
   
     5 
    6 
    9 
   10 
   
     11 
    12 
    15 
   16 
  17
  
 
User name:78
Password:1314
18

Error Message

19

202122

23

Html code

The name attribute is consistent with the attribute in the rules in the following js.

2. The code for binding the validate event in js is as follows:

1 $ (function () {2 initCardTypeFrmValidate () 3}) 4 5 function initCardTypeFrmValidate () {6 7 $ ('# cardtypefrm '). validate ({8 onkeyup: false, 9 onfocusout: false, 10 rules: {11 userName: {required: true} 12 passWord: {required: true} 13}, 14 15 messages: {16 userName: {required: 'Enter the userName '}, 17 passWord: {required: 'Enter the password'} 18}, 19 errorElement: "p" 20 }); 21}

Js Code

Onkeyup: false, indicating that the keyboard input is not verified. The default value is true.
Onfocusout: false, indicating that the input box does not verify if the focus is lost. The default value is true.

2. The solution is to disable form submission on the page and bind a form submission form in js.

1. the html code remains unchanged.

1
 
  
2
  
 
  
   
3
   
  
    4 
   
     5 
    6 
    9 
   10 
   
     11 
    12 
    15 
   16 
  17
  
 
User name:78
Password:1314
18

Error Message

19

202122

23

2. Bind and submit events in js Code

1 $ (function () {2 initCardTypeFrmValidate () 3 // optimization code 4 $ ('# cardtypefrm '). submit (function () {5 6 if ($ ('# cardtypefrm '). valid () {7 // action executed 8} 9 return false; // permanently prohibit page form submission 10}) 11}) 12 13 function initCardTypeFrmValidate () {14 15 $ ('# cardtypefrm '). validate ({16 onkeyup: false, 17 onfocusout: false, 18 rules: {19 userName: {required: true} 20 passWord: {required: true} 21}, 22 23 messages: {24 userName: {required: 'Enter the userName '}, 25 passWord: {required: 'Enter the password'} 26}, 27 errorElement: "p" 28 }); 29}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.