Chiggins
Chiggins

Reputation: 8397

Add predefined function to onclick with jQuery

This might be a little confusing. I'm creating this slider thing. When a slide is displayed, its onclick == "", and if it is hidden, onclick == "slide(#)" where # is the number of the slide. When you select a number to slide to, the current slide slides out, and the next slide comes in. During that, the onclick for the slide going out is suppose to == "slide(#)", and the onclick for the slide coming in is suppose to == "". My problem is reattaching the slide() to the onclick for the slide going out.

Here is my code so you can see everything that is going on: http://chigstuff.com/header/

Hopefully you can understand what I'm talking about. Thanks!

Upvotes: 0

Views: 995

Answers (1)

William Niu
William Niu

Reputation: 15853

I think you want to use the .click([function]) method instead of .attr() to assign the listeners.

Upvotes: 1

Related Questions