I am defining function func1();
I want it to take some param(s) ie
var func1(aaa, bbb){
//do something, anything!
};
then i want to call it later in the doc something like this:
$('#some_id').click(func1($this));
but its not working.
I’ve been messing with it for a while but its very strange the way jquery/javascript handles user defined functions to me at least. Can some1 provide me with simple code snippet? Thx
If all you want to pass is
$(this), you don’t need the parameter, as it will be available inside the defined function.However, you can’t add parameters like this:
Then, for your function definition, you just have
If you do want parameters other than $(this), you will need to do the following: