JSFiddle - React, Tailwind, and code Playground
by m4xout
HTML
<input type="text" id="customr21" name="customer[school_email]" class="customr-control" autocomplete="off">
<input type="submit" class="btn btn-primary button action-button" value="Create Account">
JavaScript
/*var email_string = '[email protected]';
var regexp = /[^\s]*edu.au/g;
var matches_array = email_string.match(regexp);
alert(matches_array);
// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']
if (matches_array === undefined || matches_array === null) {
// do something
alert('undefined or null');
} else {
alert('not undefined or null');
}*/
$('.action-button').on('click', function(){
alert('button clicked');
email_string = $('input#customr21').val();
var regexp = /[^\s]*edu.au/g;
var matches_array = email_string.match(regexp);
if (matches_array === undefined || matches_array === null) {
// do something
alert(matches_array + 'undefined or null');
} else {
alert(matches_array + 'allowed');
}
});