Reputation: 85
I feel so so stupid for forgetting this, but I've been out of practice for a minute, and I'm drawing a blank.
Why is slideDown being called onload rather than when the click is handled?
function buttonClicked(buttonNumber) {
$contentBox.slideDown("slow");
};
$button1.click = buttonClicked(1);
Upvotes: 3
Views: 3096
Reputation: 7681
Try this:
$button1.click(function() {
buttonClicked(1);
});
See documentation at api.jquery.com
Upvotes: 0
Reputation: 6598
You would want to structure it as
$button1.click(function() {
buttonClicked(1);
});
This will make it fire when $button1
is clicked.
Upvotes: 9