Reputation: 311
It´s possible execute 2 functions in the same event ? , for example this :
Inside input field :
<input type="text" name="example" value="ok" onclick="function1();function2();">
As you can see inside the event onclick i put 2 functions for execute when the people over the field and do click , it´s possible do this and works finally or exists other way for do this ?
Thank´s for the helps , the best regards
Upvotes: 0
Views: 75
Reputation: 57105
onclick="function3();"
js
function function3 (){
function1();
function2();
}
Upvotes: 2
Reputation: 122026
What ever you are doing is correct
onclick="function1();function2();"
It works fine.
And other way is callling function2
in the end of first function.
function function1() {
//function 1 stuff
function2();
}
Upvotes: 0
Reputation: 8954
Call one main function which calls both others.
<input type="text" name="example" value="ok" onclick="function3();">
function3(){
function1();
function2();
}
Upvotes: 0
Reputation: 28773
Put the second function function2()
in the first function function1()
.
function function1() {
function2();
// Do other things
}
And call the first function function1()
on click
<input type="text" name="example" value="ok" onclick="function1();">
Upvotes: 0