I am trying this code, but I don't know why it isn't working:
<script> 
    var inputtxt = '515';
    var letters = /^[0-9]+$/;  
    if(inputtxt.value.match(letters)) {
        document.write('Your registration number have accepted : you can try another');  
        return true;  
    } else {  
        document.write('Please input alphanumeric characters only');  
        return false;  
    }  
</script>  
I want to input a value (inputtxt) and then find if it contains only digits.
What am I doing wrong?
 
     
     
    