/* why if i didnt add(return false) i cant see the result of my console */
document.getElementById('reg').onsubmit=()=>{
let phoneinput=document.getElementById('phone').value
let phoneRe=/\(\d{4}\)\d{3}-\d{4}/ig //(1234)567-8910
let validationResult=phoneRe.test(phoneinput)
console.log("🚀 ~ file: main.js:5 ~ document.getElementById ~ validationResult:", validationResult)
// return false
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter