views:

37

answers:

2

I tried to do this:

try{
  (function($){

    ... my plugin stuff
  })(jQuery);

}catch(er){

  alert("an error occurred"); 
}

but this doesnt seem to work =/

I'm also trying to figure out how to do this in Mozilla vs IE vs Chrome

Thanks!

A: 

You're catching any errors that occur during the creation of your plugin. When the plugin actually gets to being used, there will be no error catching. Place the try catch inside the plugin code to achieve the latter.

Matt
A: 

Probably the exception is thrown in the code that is executed asynchronously. You have to use the try...catch inside the plugin code.

PanJanek