The onchange
will fire when you leave the focus from it (if you performed any changes). This behavior occurs only with text
and textarea
input types because javascript doesn't know when you're done typing.
I don't know why there is a checkbox in the code, but whatever. Sincerely, I'm not being able to tell you why, but the problem is the dynamic value change on the input (a guess would be that the change isn't performed by the user, but I really don't know), if you remove the code inside the onkeyup it will work. Whatever, if what you want is to execute some code when the input loses focus, you can use onblur
instead, is more accurate in that case.
onkeyup="this.value = (new Date()).getSeconds();this.onchange();"
– Aeromarine