im trying to validate that the input in 2 input fields in html are only chars, if not i want to show user a massege, im using html and js:
html:
  Player one name: <input type="text" id="firstname" maxlength="20"><br>
  Player two name: <input type="text" id="secondname" maxlength="20"><br>
  <input type="submit" value="Submit" id="submitBtn" onclick="insertNames();"/>
js:
function insertNames()
{
    var nameOne = document.getElementById("firstname").value; //saves values
    var nameTwo = document.getElementById("secondname").value;
    var letters = /^[A-Za-z]+$/;   
    if(nameOne == "" || nameTwo == "" || !(nameOne.match(letters)) || !(nameTwo.match(letters))&& (nameOne == nameTwo)){
    if( nameOne == nameTwo )
        alert("Please enter only characters.")
        break;
    }else
         console.log("ok");
}
when im trying to enter strings with numbers it does not print to the console but neither does show the window alert, what am i doing wrong?
thanks!
 
     
     
     
    