I want to call a JS function when a button is clicked and then continue execution of below jquery script
Form :
<form id="my_form">
<button type="button" id="Bshift" onclick="validation()">Clear</button>
</form>
Pure JS Function:
function validation(){
// this has to be executed first
// do something here..
}
Jquery:
$(document).ready(function(){
$('#Bshift').submit(function(){
// this has to be executed second
// do something here.
}
});
I would like to know is how I execute my function before my jquery submit.
validationto yourr click handler. What you instead do is assign whatever the execution of that function returns by assigning the function executionvalidation()to theonclickhandler.