I am trying to call a function with parameters using jquery .click, but I can't get it to work.
This is how I want it to work:
$('.leadtoscore').click(add_event('shot'));
which calls
function add_event(event) {
blah blah blah }
It works if I don't use parameters, like this
$('.leadtoscore').click(add_event);
function add_event() {
blah blah blah }
But I need to be able to pass a parameter through to my add_event
function.
Has somebody done this specific thing before? I know I can use .click(function() { blah }
, but I call the add_event
function from multiple places and want to do it this way.
Thank you!