jQuery .find()语法错误 [英] jquery .find() syntax error

查看:181
本文介绍了jQuery .find()语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以发现导致结果不出现的错误吗?

Can anyone spot the error that is causing the results to not appear?

如果我删除"FROM HERE"和"TO HERE"注释之间的代码,则一切正常(至少在屏幕上显示).我很确定问题出在.find()语法上.

If I remove the code between the "FROM HERE" and "TO HERE" comments, everything works (well, it appears on screen at least). I'm pretty sure the problem is with the .find() syntax.

代码在$(document).ready上运行

Code runs on $(document).ready

$.ajax({
    type: "POST",
    url: "ajax/ax_all_ajax_fns.php",
    data: 'request=index_list_contacts_for_client&user_id=' + user_id,
    success: function(data) {
        $('#contact_table').html(data);
        var tbl = $('#injected_table_of_contacts');
    /* ************** FROM HERE *********************** */
        tbl.find("div").each(function() {
            $(this).dialog({
                autoOpen: false,
                height: 400,
                width: 600,
                modal: true,
                buttons: 
                    {
                        Okay: function() {
                            $( this ).dialog( "close" );
                        }
                    },
                    {
                        Cancel: function() {
                            $( this ).dialog( "close" );
                        }
                    },
                close: function() {
                    alert('DialogClose fired');
                }
            })
        });
    /* ************** TO HERE *********************** */
    }
});

推荐答案

Cancel按钮不正确.

                buttons: {
                    Okay: function() {
                        $( this ).dialog( "close" );
                    },
                    // you have to put cancel here
                    Cancel: function() {}
                },
                // It should not be here
                //{
                //    Cancel: function() {
                //        $( this ).dialog( "close" );
                //    }
                //},

这篇关于jQuery .find()语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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