Secret Orange Web Log

jQuery tabs and Stylish Select disabling all tabs in IE

There is an issue with an incompatibility beween jQuery tabs and The Stylish Select plugin.

Stylish Select defines Array.prototype.indexOf which doesn't well with jQuery.

Calling .tabs() will result in all tabs being disabled, apart from the selected tab (I've only noticed this in IE).

As a workaround I temporarily destroy the reference to indexOf, call tabs() then hook the reference back up again. Pop the code below into a common js file.

SecretOrange._ArrayIndexOfTempStorage = null;
SecretOrange.RemoveIndexOfReference = function() {
    SecretOrange._ArrayIndexOfTempStorage = Array.prototype.indexOf;
    Array.prototype.indexOf = null;
}

SecretOrange.RevertIndexOfReference = function() {
    Array.prototype.indexOf = SecretOrange._ArrayIndexOfTempStorage;
}

And then use:

SecretOrange.RemoveIndexOfReference();
$("#MyTabs").tabs();
SecretOrange.RevertIndexOfReference();
All should be fine.

3 comment(s)

  1. Gravatar of Flight
    - Flight says:
    Thank you! Three hours of searching. Big, big thanks!
  2. Gravatar of Ian
    - Ian says:
    Thanks alot, this took me ages to find, just thought it was Internet Explorer being rubbish as per usual!
  3. Gravatar of Lee Gunn
    - Lee Gunn says:
    Yeah, this one was a bit of a ball ache to track down.

Want to Leave a comment?

Name:  
Email:  
Website:
Comment: