So in my check phone number function, I have: the variable pn represents the textfield where the client inputs the phone number.
The desired format is: 000-0000 (obviously not only zeroes, but any digit 0-9).
How can I use regex to validate that it is in the desired format, and give an alert if it isn't? This is what i have
var pn = document.getElementById('ph').value;
//var vd = pn.search?
//if(not valid, alert("Not a valid number!");