Created 2 events onekeyup and onchange (for checking just the length of not more than ten digits). The function does not work correctly. How to set the conditions so that you can enter no more than ten digits? Thank.
<input type="text" maxlength="10" name="answer" id="t" onkeyup="isAllowedSymbol(this);" onchange="checkLength();" placeholder="Enter data" > function checkLength() { var element = document.getElementById('t'); if(document.createEvent) { var e = document.createEvent('HTMLEvents'); e.initEvent('change', false, true); element.dispatchEvent(e); alert("ivalid length - 10 characters only!"); return element; } } limit the input of elements, roughly speaking, so that the elements would be no more than 10
maxlength for keyboard input, not via buttons