javascript - Executing multiple events JS -


given page 2 input text fields , button:

<form action="#" method="post"  id="form_register">     <input type="text" name="username_input" id="username_input">     <input type="text" name="password_input" id="password_input">     <button type="submit">go</button> </form> 

and given following js script:

$("#username_input").blur(function(){      //do 1 });  $("#form_register").submit(function(){    //do 2 }); 

whenever select (focus) "#username_input" , try click on button submit form, "do 1" executed. wish execute first "do 1" , after "do 2". possible?

$("#username_input").blur(function(){      //do 1    dosomething2(); }); function dosomething2(){    //do 2 } $("#form_register").submit(dosomething2); 

Comments