user1980542
user1980542

Reputation:

Showing a hidden link upon clicking another link

I have a page that will show 2 graphs, with different information in them, depending on which link is clicked at the top of my page (adding the variable in the address line).

When clicking this link, i also want to have a button appear below the graphs, adding an option to download the entire database.

I have looked into this, and found a solution that "should" work, but it does not.

My Menu:

 <div class="menu">
    <a href="mf.html?area=AC">KMA</a>
    <a href="mf.html?area=OC">KMO</a>
 </div>

The jQuery (placed inside the Docuemnt.ready function):

$("#menu").click(function () {
    $("#downloadlink").show();
});

And lastly, the link i want make appear: Click here to download databse

The above does not work. If anyone could provide help on the matter, i would be much appreciated, as im quite frankly getting a bit frustrated, this close to the weekend!

Thanks in advance, Jon.

Upvotes: 0

Views: 83

Answers (3)

techfoobar
techfoobar

Reputation: 66693

The class selector is of the form .classname and not #classname

$('.menu a').click(function() {
    $("#downloadlink").show();
    return false; // important
});

should do the trick.

Upvotes: 1

john Smith
john Smith

Reputation: 17936

it´s difficult to figure out what´s the problem but you could try to trigger the click on the anchors, it may be they are in "front" of the div so you click them instead of div.menu

$(".menu a").click(function () {
    $("#downloadlink").show();
});

Upvotes: 2

Maria Ioannidou
Maria Ioannidou

Reputation: 1564

Try:

$(".menu a").click(function () {
    $("#downloadlink").show();
});

Upvotes: 3

Related Questions