简体   繁体   English

Jquery UI按钮功能在弹出对话框打开时执行

[英]Jquery UI Button function execute on popup dialog open

This is my Code, after popup dialog box open need to click the button the function given should work.这是我的代码,弹出对话框打开后需要单击给定的功能应该工作的按钮。

$(document).ready(function () {
            var box = $('#openbox').dialog({
                autoOpen: false,
                width: 100,
                height: 200,
                title: 'hi',
                modal: true
            });
            $('#open-box').click(function () {
                getbtn = $('#openbox').dialog({
                    buttons: {
                        "view": sayhi()
                    }
                });
                getbtn.dialog("open");
            });
            function sayhi() {
                alert("hi..");
            }
        });

But problem is while opening popup dialog box the function sayhi() is working.但问题是在打开弹出对话框时函数 sayhi()正在工作。 not showing any name in button and button click in popup box not working.按钮中未显示任何名称,弹出框中的按钮单击不起作用。 how to do this?这该怎么做?

You can not call function like that because你不能这样调用函数,因为

"view"://here you have  object which have method view 

To call that try调用该尝试

getbtn.button.view 

and to call directory just use this并调用目录只需使用它

"view": sayhi();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM