jQuery Accordion 'Object doesn't support this property or method' error in IE

10 August 2011

Today we ran into an "Object doesn't support this property or method." error caused by an jQuery UI Accordion effect in a page. The error was vague and the IE Developer Tools Stack trace wasn't making thing clear either.

Doing a search on Google we found many other people having the same problem, but after trying some of the suggested solutions, we found one which was our problem ánd solution.

It turns out that, when using an Accordion() effect, the order of the HTML elements is só strict it throws errors, and crashes the script when you don't follow these rules.

The DOM structure of an Accordion() should look like this:

<h3>a header</h3>
<div>some content</div>
<h3>another header</h3>
<div>some more content</div>

And in our case it was like this:

<h3>a header</h3>
<div>some content</div>
<input type="hidden" name="hidden_value" value="secret" />
<h3>another header</h3>
<div>some more content</div>

The solution was to move the hidden input fields and other tags inside the DIV's that form the content containers.
You must have JavaScript enabled to use this form!

Leave a comment!

  1. Your mail is safe with me. It's only only used to display your Gravatar image!

0 comments

Please feel free to be the first to comment on this page!

By placing a comment you let me know i'm doing a good job. It doesn't have to be constructive, just a "awesome!" makes me really happy! You contribute to a better world!