Why am I receiving a typeerror that says "cannot read property of 'match' undefined"?
var numInput = document.getElementById('input');
// Listen for input event on numInput.
numInput.addEventListener('input', function(){
// Let's match only digits.
var num = this.value.match(/^\d+$/);
if (num === null) {
// If we have no match, value will be empty.
this.value = "";
}
}, false)