Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Target IE7 with jQuery

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

if($.browser.msie && $.browser.version.substring(0) == "7") {
    //Do something
}

Is this correct?

like image 660
mtwallet Avatar asked Dec 16 '10 17:12

mtwallet


1 Answers

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.

like image 177
karim79 Avatar answered Sep 28 '22 11:09

karim79