I need to validate the input value to ensure it only contains "o" or "x". If the input value is anything else, I want to display an alert. Currently, the alert pops up even when I enter "o" or "x". Any assistance would be greatly appreciated. Here is the code I am using:
var block=document.getElementById("block");
block.change = check;
function check(){
if(block.value !== "o" || block.value !== "x" || block.value !== ""){
window.alert('Please input "o" or "x" only');
return false;
}
else{
return true;
}
}
<input type="text" name="block%s" id="block" onchange="check()">