JQuery + Simple dialog

I have jQuery model windows that contain a form.

When creating a page, I can see the fields, although in my dialog box I set autoOpen to false.

All forms are in a div.

A sample of my dialogue is as follows:

$("#dialog-form").dialog({ autoOpen: false, height: 460, width: 750, modal: true, buttons: { 'Create Map': function() { document.registerFrm.submit(); }, Cancel: function() { $(this).dialog('close'); } }, close: function() { allFields.val('').removeClass('ui-state-error'); } }); 

In any case, I do not want the form fields to be visible when loading / creating the page.

+4
source share
1 answer

You need to hide it in CSS first, for example:

 #dialog-form { display: none; } 

Opening a dialog box will lead to its display ... this is what the authors of the dialog widget are waiting for :)

Alternatively, hide the div containing all forms ... no matter what you want to hide only display:none on this shell, the dialog will capture and show this or something in it and show it accordingly (just don't use make display for each child, just a wrapper), for example:

 <div style="display: none;"> <div id="dialog-form">fields here</div> <div id="dialog-form2">fields here</div> </div> 

Or simply:

 <div id="dialog-form" style="display: none;"> fields here </div> 
+5
source

Source: https://habr.com/ru/post/1306898/


All Articles