1

I am activating a dialog box like so:

   $('a#addNew').click(function(){
   $('#popup').dialog({
       minWidth:  700,
       title:     'Select a product item'
   });
});

<div id="popup" style="color:#fff; background:#000; width:650px;">
    blah blah blah blah
</div>

thats all well and good.. but the dialog box (#popup) is actually showing up on my page until i click #addNew, in which case it disappears and transfers to the actual dialog box. I only want the user to see that information when they click on #addNew. I dont want it to be sitting on the page. What am i doing wrong here?

3 Answers 3

3
<div id="popup" style="color:#fff; background:#000; width:650px; display:none;">
    blah blah blah blah
</div>

You need to hide this div while it is on the page. The dialog will then unhide it and display it for you.

Sign up to request clarification or add additional context in comments.

4 Comments

I'd take it a step further; instead of inline styles, move this to the CSS stylesheet. But this is the right idea.
oh yeah.. duh. i didnt know it would auto unhide it for me.
yeah i know inline styles are frowned upon. just easy right now while im building the page.
Beware, it's easy now, but when your page is nearly complete and you look at all the inline styles you now have to refactor into a stylesheet you may be kicking yourself for not just doing it from the start.
0

using css add
display:none;

or using JQuery add
$('#popup').hide();

Comments

0

It's on the main page because that's where you put it!

You need to hide the div (css - display: none) when its first created.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.