Instead of something like this
$('#submitbutton').click(function(e) {
e.preventDefault(); //to avoid the submit button to reload the page and go page to page one.
/* computing dimensions */
});
I'd like to put my function somewhere else, like this :
$('#submitbutton').click(computeUserDimensions);
function computeUserDimensions(){
/* computing dimensions */
}
But then I don't where to put the preventDefault
to provide the click (which is on a submit button) to go to another page.
Can you help me figure this out?
Thanks
Add parameter event
to your function and it will be passed by jQuery
implicitly.
$('#submitbutton').click(computeUserDimensions);
function computeUserDimensions(event){
/* computing dimensions */
event.preventDefault();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With