jQuery对话框作为输入 [英] JQuery dialog as input

查看:287
本文介绍了jQuery对话框作为输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不太习惯使用jquery对话框和其他东西. 所以这是一个新手问题.

I'm not very used to working with jquery dialogs and stuff. So this is kind of a newbie question.

此刻,我正在使用提示从SharePoint中的用户那里得到答复.

At this moment I'm using the prompt to get a reply from the user in my SharePoint.

var answer = dialog("Type the text you want to display in the email.");

但是我的输入受到限制.

But then my input is limited.

有人可以帮助我吗?

添加. 现在,我可以插入对话框了.但是我无法显示它.

Addition. I was now able to insert my dialog. But I'm not able to display it.

这是我插入的方式:

if ($("#dialogSendMail").length) {

}
else {
    $("#DeltaPlaceHolderUtilityContent").after("<div id='dialogSendMail' title='Enter mail body'> <label for='mailBody'>Type the text you want to display in the email:</label><p><input type='text' id='mailBody' name='mailBody'></p></div>");
}

这是我尝试显示的方式:

And this is how I try to display it:

        var answer ="";

    $( "#dialogSendMail" ).dialog({
            resizable: false,
            height:350,
            width:650,
            modal: true,
            autoOpen : false,
            buttons: [
                {
                    text: "Send Mail",
                    click: $.noop,
                    type: "submit",
                    form: "myForm"
                },
                {
                    text: "Close",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ]
        });

但是当我运行代码时,它不会显示对话框. 另外,我正在尝试找到一种从文本框中获取响应的方法.

But when I run my code, it doesn't display the dialog. Additionally i'm trying to find a way to get the response from the textbox.

有人可以帮助我吗?

推荐答案

纯jquery没有此类对话框,请改用jquery UI. 你真正的问题是什么?

There are no such dialog for pure jquery, use jquery UI instead. What is your real question?

$( "form" ).dialog({
    open: function() {
        // On open, hide the original submit button
        $( this ).find( "[type=submit]" ).hide();
    },
    buttons: [
        {
            text: "Find",
            click: $.noop,
            type: "submit",
            form: "myForm" 
        },
        {
            text: "Close",
            click: function() {
                $( this ).dialog( "close" );
            }
        }
    ]
});

小提琴: http://jsfiddle.net/s9ff3gjs/1/

这篇关于jQuery对话框作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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