JQuery dialog as input

I'm not very used to working with jquery dialogs etc. So this is a newbie question.

At this point, I am using a prompt to get a response from a user in my SharePoint.

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

      

But then my input is limited.

Can anyone help me?

Adding. Now I was able to insert my dialog. But I cannot display it.

This is how I put it in:

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. Also, I am trying to find a way to get the answer from the textbox.

Can anyone help me?

+3


source to share


1 answer


There is no such dialog for pure jquery, use jQuery UI instead. What's 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" );
            }
        }
    ]
});

      



script: http://jsfiddle.net/s9ff3gjs/1/

+2


source







All Articles