I currently have a button in a html form which executes a function when it is clicked:
<input type="button" onclick="do_action_1();">
But I have two functions:
do_action_1()
do_action_2()
I also have two text boxes:
<input id="tb1" type="text" name="textbox1">
<input id="tb2" type="text" name="textbox2">
If the user's cursor is in textbox1, I want the button to carry out
do_action_1
but if the user's cursor is in textbox2, I want the button to carry out
do_action_2.
I'm not sure where to begin when doing this so any help is much appreciated.