0

我有 $("#accordId").val() from servlet ,这是表单提交之前的手风琴 ID,我想打开同一个手风琴。

$(document).ready(function() {
        aId = $("#accordId").val();
        alert(aId);
        if(aId =="")
            aId = 0;
        $("#accordionCategory").accordion({
            collapsible  : true,
            active       : false,
            heightStyle  : "content",
            navigation   : true,
            active: aId
        });

});

警报给出了正确的结果,但没有打开正确的accordin菜单,请帮助

4

3 回答 3

1
$(document).ready(function() {
        aId = $("#accordId").val();
        alert(aId);
        if(aId =="")
        { // here you foreget "{" 
  aId = 0;
        $("#accordionCategory").accordion({
            collapsible  : true,
            active       : false,
            heightStyle  : "content",
            navigation   : true,
            active: aId
        });
}

});
于 2013-08-26T13:30:01.770 回答
0
$(document).ready(function() {
        aId = parseInt($("#accordId").val());
        if(aId =="")
            aId = 0;
        $("#accordionCategory").accordion({
            collapsible  : true,
            active       : false,
            heightStyle  : "content",
            navigation   : true,
            active: aId,
            form: "formname"
            change: function (form) {
            var index = $(this).accordion("option", "active");
            $(aId).val(index);
        }
        });
});
于 2013-08-27T12:53:04.133 回答
0
$(document).ready(function() {
        aId = $("#accordId").val();
        alert(aId);
        if(aId =="")
            aId = 0;
        $("#accordionCategory").accordion({
            collapsible  : true,
            active       : false,
            heightStyle  : "content",
            navigation   : true,
            active: aId,
            form: "formname"
            change: function (form) {
            var index = $(this).accordion("option", "active");
            $(aId).val(index);
        }
        });
});
于 2013-08-26T13:53:08.770 回答