jQuery Validation plugin, IE7 “SCRIPT3: Member not found”

前端 未结 5 1400
天涯浪人
天涯浪人 2020-12-28 08:34

I have the following:


    
    
    
        
5条回答
  •  别那么骄傲
    2020-12-28 09:06

    What I found causing the problem is line 35 of jquery.validate.js

    this.attr('novalidate', 'novalidate');
    

    Comment out this line and problem is sovled. You could also wrap it with a ( current browser <= ie7) to explictly avoid this line only when ie7 is the broswer.

    Update To comment out line only for ie7 you can use the following code:

    var ie = (function () {
            var undef,
        v = 3,
        div = document.createElement('div'),
        all = div.getElementsByTagName('i');
            while (
        div.innerHTML = '',
        all[0]
    );
            return v > 4 ? v : undef;
        } ());
    

    and then:

        if (!ie || ie > 7) {
          this.attr('novalidate', 'novalidate');
        }
    

提交回复
热议问题