Adding functions

Adding functions

Hey guys,

I have a very newbish question, but I have searched for a long time and did not find an answer anywhere. How do I add my own functions (methods). I am a Java / C# / PHP programmer so I am used to making functions/methods to simplify my code and to make it easier to reuse parts of it. However, I am not exactly sure how to do this in jQuery. Let me just give you a very simple code snippet in Java to make sure you understand what I mean.

  1. public void myMethod() {
  2.        // My code here
  3. }

Then I can call that method by writing myMethod();

How can I do this in jQuery? Sorry if it's a stupid question. :(