JSFiddle - React, Tailwind, and code Playground

by m4xout

HTML

<input type="text" />
<input type="submit" class="btn btn-primary button action-button" value="Create Account">

JavaScript

$('.action-button').on('click', function(){
    str = $('input').val();
    str = str.split('@').slice(1);
    
    var allowedDomains = [ 'steve.com', 'Pete.com', 'jack.com', 'John.com' ];
    
    if ($.inArray(str[0], allowedDomains) !== -1) {
        alert(str + ' is allowed');
    }else{
        alert('not allowed');
    }
});