I have multiple functions that need to fire on the onChange event will this work?
I cannot combine the functions.
onChange="avgFloatPipe(), ReserveFloatingPipe()"
Thanks!
onChange="avgFloatPipe(); ReserveFloatingPipe();"
if you insist on doing it inline and not making a third function that calls the other two.
If you plan on doing things inline that syntax should be fine. You could also terminate each function call with a semicolon.
http://codepen.io/anon/pen/JXevRy
function test1() { alert(1); } function test2() { alert(2); }
<input onchange="test1(), test2();" /><br /> or separating the statements<br /> <input onchange="test1(); test2();" />
You could also wrap the functions with a third function and call them both
function test1() { alert(1); } function test2() { alert(2); } function test3() { test1(); test2(); }
<input onchange="test3()" />
A third option is to bind the event using javascript. One way to do this is by using an anonymous function.
function test1() { alert(1); } function test2() { alert(2); } document.getElementById("example").onchange = (function () { test1(); test2(); });
<input id="example" />
只需用半冒号分隔功能即可:
onChange="avgFloatPipe(); ReserveFloatingPipe()"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.