views:

52

answers:

3

In css when you want something to be ie only you can comment it out and assign ie. I have a jquery plugin that breaks in IE I don't want it to run in ie but I want it to run in all other browsers. How can I do this?

this worked!

jQuery(function() {
if(jQuery.browser.msie){}
else
{$('.div').corner("round 20px");};
});
+1  A: 

Add some form of browser checking code that wraps your code in an if statement and only selectively runs it.

Psuedo code:

if( browse != "IE" )
{
     ... run code that breaks in IE ...
}

Or you could possibly wrap it in side of a try/catch block

webdestroya
this worked! thanksjQuery(function() {if(jQuery.browser.msie){}else{$('.div').corner("round 20px");};});
ThomasReggi
@ThomasReggi, if this is the correct answer, please use the tick and mark this as the accepted answer :)
Alastair Pitts
@ThomasReggi - Happy to help!
webdestroya
+2  A: 

Try using conditional comments.

http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

http://www.quirksmode.org/css/condcom.html

<!--[if !IE]>
Special instructions for non IE browsers
<![endif]-->
Alastair Pitts
@CMS, Woops. Fixed for non-IE browsers.
Alastair Pitts
+1  A: 

You can use jQuery.browser to check the browser and version. However, it is discouraged by the manual because it's bad practice to check only the browser name. It's much better to track down what feature in the browser is breaking the plugin and then check for that feature only with jQuery.support or similar.

Emil Vikström