jquery - separate preventDefault() from function -


instead of this

$('#submitbutton').click(function(e) {     e.preventdefault(); //to avoid submit button reload page , go page page one. /* computing dimensions */ }); 

i'd put function somewhere else, :

$('#submitbutton').click(computeuserdimensions);  function computeuserdimensions(){ /* computing dimensions */ } 

but don't put preventdefault provide click (which on submit button) go page.

can me figure out?

thanks

you can change function call anonymous function handles click , calls sub function.

$('#submitbutton').click(function(e) {e.preventdefault(); computeuserdimensions();});  function computeuserdimensions(){ /* computing dimensions */ } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -