Jump to content

hiding/showing popup

Recommended Posts

Depending on a specific value taken from the database....a popup is hidden or shown in a page.

The htlm of the popup is there but when the value is true(that comes from the db) with jquery I hide it.

That is I get the value in JS....the problem with this approach is that(in case the popup is to be hidden) on page refresh the popup appears for less that a second and then disappears.

Bad for UX.

How I could make it that when the popup is hidden does not appear at all on refresh.

Iis it better maybe to handle it server-side?

I hear opinions.



Link to post
Share on other sites

well the code works...I did not expect to work cause I had made some assumptions--which were wrong of course...I have 2 questions though.


why not do this with PHP enbedded in the HTML...why resorting to JS...something like this:


<div  <?php echo ($schedstatus == 1) ? "style='display:none;'" : "style='display:block;'" ?> id="modal">......

I have come to understand that code in a JS file tha resides INSIDE the document on load function...runs after the HTML/document is loaded...that said the modal should be shown(my assumption) and hidden WHEN the code inside the documenton load functions runs.

Obviously I miss something but what is that?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...