<input type="text" data-action="13" id="qsymbols" />
<script>
var inp = document.getElementById("qsymbols");
var action = inp.getAttribute("data-action");
inp.oninput= function () {
this.value = this.value.replace(/\D/g, '');
if (action == this.value.length) {
alert("Worked. Value length = " + action);
}
}
</script>