I have the following code:
$('.helloWorld').on('click', function() {
$(this).css('background', 'black');
});
Instead, I would like to do something like this (for research):
var params = [
'click',
function () {
$(this).css('background', 'black');
}
];
$('.helloWorld').on(params);
I get an error that reads, "Uncaught SyntaxError: Unexpected token , ."
Is this possible? If so, how?