1

Can I get a couple of good examples on how to bind 3 separate functions I've got going on?

1
  • Maybe you could be a bit more explicit. What are you binding them to? Commented Aug 10, 2009 at 15:48

2 Answers 2

4

Create one function that calls all three and then bind to that function.

Or use an anonymous function:

$("#MyItemID").bind("click", function(){
  func1();
  func2();
  func3();
});

You can also use the shorthand event. So (e.g.) for click:

$("#MyItemID").click(function(){
  func1();
  func2();
  func3();
});
Sign up to request clarification or add additional context in comments.

Comments

1

You could also just chain them:

$("#MyItemID").click(func1).click(func2).click(func3);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.