How to pass (function with parameter) as parameter?
- <a onclick="test('abc')">test</a>
- var fun1 = function( param ){
- // do something
- }
- var test = function( text ){
-
- $('.element').click( fun1(text) );
- }
I had this code, but browser will call fun1(text) directly instead of hold on and wait until user clicks on the link. Is there any solution to this? I do understand the issue is browser treat line 7 fun1 as a function call, not as a parameter.
Thanks.