I have a function that opens dialog windows. When the user clicks on the sign up button the sign up dialog should open. However, the dialog opens as soon as the page loads. If I use an anonymous function to handle the event it works fine, but I want to reuse the openDialog function for other dialogs (login, etc) so I don't want it to be anonymous.
var ready;
ready = function () {
$('.js-join-button').on('click', openDialog(event, signUp));
function openDialog(event, dialogType) {
event.preventDefault ? event.preventDefault() : event.returnValue = false;
dialogType.dialog('open');
}
...
}
$(document).ready(ready);