JSFiddle - React, Tailwind, and code Playground
by Joshua Salwen
HTML
<input type="text" id="myinput" value="vexillology"/>
<button id="testBtn" onclick=test()>test</button>
<button id="matchBtn" onclick=match()>match</button>
JavaScript
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
console.log('hi');
function getValue() {
return document.getElementById("myinput").value;
}
function test() {
console.log('hi');
console.log(mailformat.test(getValue()));
}
function match() {
console.log(getValue());
console.log(getValue().match(mailformat));
}