I have a simple event listener but need to parse this
through it to my function but don't know how.
This is what i have so far:
var inpt = document.getElementById('curq');
inpt.addEventListener("keyup", function(e,max){ int_inpt_only(e,max); } , false);
function int_inpt_only(e,max) {
this.value = this.value.replace(/[^0-9]/g,'');
if(this.value > max) this.value = max;
if(this.value<1)this.value=1;
}
The problem is this
is not defined in my function because the scope does not carry through, so i am wondering how i link them without having to look up the element two times.