I am using listeners to detect when a user finishes with textbox; when the text is value is changed, I am pasting their text on to the page using innerHTML.
document.getElementById("dateinput").addEventListener("change", function() {
myDate(document.getElementById("dateinput").value);
}, false);
Is there a way to listen for each key press to immediately paste the .value character by character as they type? I only want to do this while the textbox has focus.
Thanks.
you can use an of keyup/keydown/keypress
document.getElementById("dateinput").addEventListener("keyup", function() {
myDate(document.getElementById("dateinput").value);
}, false);
you can use onpaste
document.getElementById("dateinput").addEventListener("paste", function() {
myDate(document.getElementById("dateinput").value);
}, false);
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.