Check String in Textbox

by Marcel Ferdinand

HTML

<input type="text" id="textfield" placeholder="Insert Number" maxlength="3">
<a href="#" id="btnCheck">Submit</a>

JavaScript

$(function () {
    $('#btnCheck').click(function () {
        var numList = ['123', '456', '789'];
        var check = $('#textfield').val();
        if (numList.indexOf(check) > -1) {
            alert('Contain');
            return false;
        } else {
            alert('Not Contain');
            return false;
        }
    });
});