javascript - how to call multiple onkeyup events on one html-tag -
can call multiple onkeyup events on same html input-tag?
<input style="float: left; width: 50px;" id="personlength" name="personlength" onkeyup="checknr(this.id)" onkeyup="fill()" type="text"> something that?
<input style="float: left; width: 50px;" id="personlength" name="personlength" onkeyup="checknr(this.id), fill()" type="text"> or this? ive treid them both might have wrong syntax? or there better way it?
you not call onkeyup events, events, happen.
you can use eventlistener api add multiple event listeners.
var input = document.getelementbyid("my_input"); input.addeventlistener("keyup", function () { dosomething(); }); input.addeventlistener("keyup", function () { dosomethingelse(); }); // .. etc the alternative notation be:
<input .. onkeyup="checknr(this.id); fill()" type="text"> ^- semicolon this similar to:
var input = document.getelementbyid("my_input"); input.addeventlistener("keyup", function () { checknr(input.id); fill(); });
Comments
Post a Comment