Is it possible to use jquery in your code for one browser (eg firefox) but then disable the jquery code for another browser (eg IE10)

Problem

I have coded a site that is jquery heavy (animations, css state changes etc) that works perfectly on firefox, but has issues executing the jquery for IE. What I was wondering was is there a way of the jquery code automatically disabling when the site is viewed using IE?

Problem courtesy of: Sam Friday Welch

Solution

Sure, you can use conditional comments in the head section of your page to include jQuery only for browsers that isn't IE :

<!--[if !IE]> -->
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- <![endif]-->

conditional comments

Solution courtesy of: adeneo

Discussion

You might use a browser detect plugin, like that: Browser detect

For simple purposes, you could use:

function isIE () {
  var myNav = navigator.userAgent.toLowerCase();
  return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}

if (isIE()) {
    // no jquery
}

(from Detect IE version (prior to v9) in JavaScript)

Discussion courtesy of: tobspr

This recipe can be found in it's original form on Stack Over Flow.