Ensure that the condition is
V1.value === "12" || V1.value === "34"
.
Remember to select the #V1
input using:
const V1 = document.getElementById("V1");
const V1 = document.getElementById("V1");
function verify() {
if (V1.value === "12" || V1.value === "34") {
alert("Yes");
} else {
alert("No");
}
}
<textarea id="V1"></textarea>
<br />
<button onclick="verify()">Verify</button>
You can simplify the process as follows:
const V1 = document.getElementById("V1");
function verify() {
V1.value === "12" || V1.value === "34" ? alert("Yes") : alert("No");
}
<textarea id="V1"></textarea>
<br />
<button onclick="verify()">Verify</button>
Another way to achieve this is by:
const V1 = document.getElementById("V1");
function verify() {
V1.value === "12" || V1.value === "34" ? alert("Yes") : alert("No")
};
<textarea id="V1"></textarea>
<br />
<button onclick="verify()">Verify</button>