Pomster
Pomster

Reputation: 15197

I want to hide a DIV?

I am jQuery to use a Div as a dialog, But before the dialog is called the Div shows at the bottom of my Screen.

How can i hide this div?

<div id = "PrintDialog" title="Warning">
        <p>Once you print, no changes may be made to this contract. Are you sure you want to print?</p>
        <input type="button" value="Print" id="btnDialogPrint" />
        <input type="button" value="Cancel" id="btnDialogCancel" />
        </div>

I want to still use the Div, just not have it displayed unless its the dialog.

Thanks in advance.

Upvotes: 0

Views: 248

Answers (7)

TRR
TRR

Reputation: 1643

Just add class "hidden" to your and remove it when you want to show it as a dailog

<div id = "PrintDialog" title="Warning" class="hidden">

CSS for hidden: .hidden { display: none; }

Upvotes: 3

refeline
refeline

Reputation: 39

  1. using css (if you want init dialog later): <style type="text/css">
    #PrintDialog{display:none;}
    </style>

  2. Using jQuery UI you just need to initialize dialog after page loaded:
    <script type="text/javascript">
    $(function(){
    $("#PrintDialog").dialog({ <some arguments such as title and so on> });
    });
    </script>

Upvotes: 2

Jonathan
Jonathan

Reputation: 6732

Add style="display: none;" to the div like this:

<div id="PrintDialog" title="Warning" style="display: none;">

When the page loads, this prevents the div from being showed. jQuery will still show the dialog when you want it.

Upvotes: 5

Logan
Logan

Reputation: 1694

Use css : style="display:none"

<div id = "PrintDialog" title="Warning" style="display:none">

or use following jquery code

$('#PrintDialog').hide()

Upvotes: 3

ericosg
ericosg

Reputation: 4965

Try using the built in .hide() method.

i.e.

$('#PrintDialog').hide();

Upvotes: 0

Niklas
Niklas

Reputation: 13135

If you want to use jQuery you just add $("#PrintDialog").hide(); in your code.

Upvotes: 1

Arbejdsgl&#230;de
Arbejdsgl&#230;de

Reputation: 14088

Add style="display: none;" or add to your CSS class next code

#PrintDialog
{
display: none;
}

Upvotes: 2

Related Questions