开发者

Target IE7 with jQuery

开发者 https://www.devze.com 2023-01-31 04:02 出处:网络
I am trying to target IE7 with an if statement in a jQuery function. My code to this specific bit is:

I am trying to target IE7 with an if statement in a jQuery function. My code to this specific bit is:

if($.browser.msie &a开发者_开发技巧mp;& $.browser.version.substring(0) == "7") {
    //Do something
}

Is this correct?


Try:

if($.browser.msie && parseInt($.browser.version, 10) == 7) {
    //Do something
}   

And as @Andrew Whitaker comments, instead of targeting a specific browser, consider detecting features instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消