I have an input element and I want to keep checking the length of the contents and whenever the length becomes equal to a particular size, I want to enable the submit button, but I am facing a problem with the onchange event of Javascript as the event fires only when the input element goes out of scope and not when the contents change.
<input type="text" id="name" onchange="checkLength(this.value)" />
----onchange不会在更改名称的内容时触发,但只在名称失go 焦点时触发.
Is there something I can do to make this event work on content change? or some other event I can use for this? I found a workaround by using the onkeyup function, but that does not fire when we select some content from the auto completer of the browser.
我想要的东西,可以工作时,该领域的内容发生变化,无论是通过键盘还是鼠标...有什么 idea 吗?