I am manually calling .click() on a button on a page in my jquery/javascript code.
I need to pass a parameter to click that I can then read on the function that responds to the click event.
is this possible?
You need to invoke .trigger(). You can pass over any amount of arguments there.
$('element').trigger('click', [arg1, arg2, ...]);
These extra parameters are then passed into the event handler:
$('element').bind('click', function(event, arg1, arg2, ...) {
});
Reference: .trigger()
<button id='test'>
var btn = $("button#test");
btn.attr("param", "my parameter");
btn.click();
No. Your onclick event is separate from your click() function. Normally, this would be possible through arguments[], but in this case you're going to have to use a variable.