-1

Possible Duplicate:
Jquery css show div?

Ok this is my problem that no one can seem to answer. I have two javascripts in use. Once is for the popup I have and tells it to stay closed for 24hrs when closed. The other is to put a link some where on the page to display this popup until refreshed and kept hidden till the cookie expires. Now the div popup is set to display:none. The cookie tells it to be shown until the close button is pressed. No matter what I seem to rework in my javascript to tempoarly show the popup from a link, it will not show. Some how the cookie javascript is going to have to be modified and thus having to remove css:display:none on the popup div. I have no idea what to do.

This is the current code:


<script type="text/javascript"> 
$("#linkshow").click(function {
$("#window").show()
});        
</script>

<a href="#" id="linkshow">Submit a comment</a>
<div id="window">
...
<div>
<script type="text/javascript">
...cookie popup hide for 24hr on close
</script>

Note: I have already tried:

$(document).ready(function() {
   $("#linkshow").click(function(e) {
      e.preventDefault();
      $("#window").show();
   });
}); 

and...

$(document).ready(function() {
     $("#window").hide();

   $("#linkshow").live('click', function(e) {
      e.preventDefault();
      $("#window").show();
   });
}); ​

and...

$(function() {
        $("#linkshow").click(function() {
            $("#window").show()
        });        
    });

and...

<div id="window" style="display:none;">

to

<div id="window">

Then the other 24hr cookie javascript doesn't keep the popup hidden. I am assuming I need to take out the id="window" style="display:none; and some how advanced the javascript cookie at the bottom the code so it will hide when asked to be hidden for 24hr and show when needed to be shown on the current page until refresh but I am at blank on what to do.

1
  • Your code is Working fine for me at THIS DEMO Commented May 21, 2012 at 14:10

4 Answers 4

0
$(document).ready(function() {
     $("#window").hide();

   $("#linkshow").live('click', function(e) {
      e.preventDefault();
      $("#window").show();
   });
}); ​

for live demo see this link: http://jsfiddle.net/nanoquantumtech/wTmCL/

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

1 Comment

sorry that does not work with my additional code I linked
0

you should load jquery library first :

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

1 Comment

thought it was obvious I did that with all of this code
0

if you want to do the popup, you may look into jquery dialog. The code above will only show the div but not poping it up.

Jquery dialog will do the popup and make sure you referent jquery ui. http://jqueryui.com/demos/dialog/

4 Comments

sorry that doesn't help at all being that I have a separate javascript that tells the popup to stay closed for 24hrs
I just look at the entire code, Since you have display: none; you need to set it back to inline or sth. Show() won't do it for you. Maybe try this .css('display', 'block !important')
no sorry, my cookie javascript is going to have to be reworked. nothing is workin
I can hide the div for 24hr but i cant use a link to make it display when i want it to
0

also your html is incorrect and also , hiding a element using css is better than hiding by jquery when page loading

use

<div id="window" style="display:none;">
...
</div>

instead of

<div id="window">
...
<div>

3 Comments

then where do I but the hide at in the javascript cookie
@Zach Reynolds , please check your code , do you see any javascript errors , please test it using firebug
no i do not, i guess I will never get this resoloved

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.