0

i want to pass the event to function in javascript suppose. i am fire function from two input. then how i can call the event with passing parameter.

can i do this using calling and without binding event in jQuery.

Anirudha Gupta
  • 9,073
  • 9
  • 54
  • 79
  • Keyword: "closure" (although this can be wrapped in many different ways.) –  Jul 29 '11 at 06:01
  • See http://stackoverflow.com/questions/1300242/javascript-passing-a-function-with-parameters-as-a-parameter and http://stackoverflow.com/questions/4429328/passing-an-argument-into-a-function-as-a-parameter-of-a-function-call for instance. –  Jul 29 '11 at 06:01

2 Answers2

1

I'm not exactly sure what you're asking, but here's an example of passing a function with parameters as a callback:

setTimeout(function() {
    return myFunction(false, 3);
}, 1000);

You wrap your function call in an anonymous function wrapper.

jfriend00
  • 683,504
  • 96
  • 985
  • 979
0

Example:

function DoCSSStuff(param1,param2)
{
     $(param1).css('height', param2);

};

That way you could call the css function to manipulate height with passed parameters.

Semyazas
  • 2,101
  • 14
  • 14