Why won't jQuery accordion section activate in IE 8?

寵の児 提交于 2019-12-13 05:29:33

问题


I am using a multi-part form within the jQuery UI accordion. When a user clicks on "next," the next section that has not already been submitted opens. It is not working properly in IE 8 - the next section does not open. Anyone have any thoughts on what I can do here to ensure compatibility with IE 8?

EDITED UDPATE TO QUESTION: Using IE Developer Tools, I found that the code is breaking at "next=i." The error states "Object doesn't support this property or method." Any thoughts as to what I'm doing wrong here?

$(":submit").live('click', function() {
whichButton =  $(this).val();
})

$("#selection-form").validate({
   submitHandler: function(form) {
     var acc = $("#accordion");
//...
   complete: function(e) {
     $('#selection-information').attr('state', 1);
     acc.children('.step').each(function(i){
         if($(this).attr('state') == 0) 
            {
        next = i;
        return false;
        }
    })
        if(whichButton=='complete'){
         acc.accordion('activate',next);            
}

//...

UPDATE: The problem seems to be with trying to activate with "next," rather than with a specific index number (even though "next" is supposed to identify the index to open). If I replace "next" with an actual index number, that section opens. Any thoughts on how to fix this specific problem?


回答1:


I ran into this same problem. IE is very finicky about proper html and making sure that inside your accordion, there is nothing outside the <h3></h3><div></div> structure, for example, it you have this:

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

it will work, but this will not:

<h3>a header</h3>
<div>some content</div>
<span>extra stuff</span>
<h3>another header</h3>
<div>some more content</div>

This would all be inside whatever element you call .accordion() on.




回答2:


Apparently, there was a conflict or problem with the use of the name "next." I changed "next" to "nxt" within the function and the accordion is now working in IE8.



来源:https://stackoverflow.com/questions/6089767/why-wont-jquery-accordion-section-activate-in-ie-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!