Which other event handler than click could i use?

Posted by Gaelle on Stack Overflow See other posts from Stack Overflow or by Gaelle
Published on 2012-11-23T22:51:34Z Indexed on 2012/11/23 23:03 UTC
Read the original article Hit count: 171

I have a jQuery question, and I really think it is a silly one : i'm a beginner in JS and jQuery...

I'm using

$("#myLink").click(function(){
    $(".myClassToShow").show();
    $(".myClassToHide").hide();
});

to hide elements with class myClassToHide as a class attribute and show elements with class myClassToShow as a class attribute. I think this is really easy to understand :)

I didn't think it would hide every elements with the good class, but, well, it works.

My worry here is that my elements show and hide only for few seconds : the time my mouse click on the link.

I would like to make myClassToShow elements remaining on the screen, when i already clicked my link, and myClassToHide elements really hide.

For example, on the johann Hammarstrom's website, when you click on "Print", all his works which are not print gone hide, and only the printing one remain.

That's kinda what i want. I searched using Firebug, but couldn't find which kind of event he used. I know a onchange is not the correct answer, so what?

Could you help me please?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery