为什么jQuery手风琴部分不会在IE 8中激活? [英] Why won't jQuery accordion section activate in IE 8?

查看:113
本文介绍了为什么jQuery手风琴部分不会在IE 8中激活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery UI手风琴中使用多部分表单。当用户点击下一步时,将打开尚未提交的下一部分。它在IE 8中无法正常工作 - 下一部分无法打开。任何人都对我在这里可以做什么有任何想法,以确保与IE 8的兼容性?

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?

编辑UDPATE到问题:使用IE开发人员工具,我发现代码正在打破下一个= 1。错误指出对象不支持此属性或方法。有什么想法我在这里做错了吗?

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);            
}

//...

更新:问题似乎是尝试使用next激活而不是使用特定的索引号(尽管next应该标识索引到如果我用实际的索引号替换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?

推荐答案

我遇到了同样的问题。 IE非常挑剔正确的html 确保在你的手风琴里面,< h3>< / h3>< div>< / div> ; 结构,例如,你有这个:

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>

它会起作用,但不会:

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

这一切都在你调用.accordion()的任何元素内。

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

这篇关于为什么jQuery手风琴部分不会在IE 8中激活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆