Question
-
Topic
-
Making text input enabled dependant upon radio buttons in WordPress
LockedI have an HTML form on a WordPress page and I want a text field to be enabled or disabled, depending on what the user selects from a set of radio buttons.
I think I’ve got the ingredients together, thus:
1) HTML says:
<input type=”radio” id=”Dash” name=”SepType” value=”Dash” onChange=”disableElement()” required>
<label for=”Dash”>Dash</label><br>
<input type=”radio” id=”Dot” name=”SepType” value=”Dot”>
<label for=”Dot”>Dot<br></label>
2) custom.js in public_html folder has:
function disableElement() {
window.alert (9);
switch (document.getElementById(“SepType”)) {
case “None”:
document.getElementById(“sname”).disabled = true;
break;
default:
document.getElementById(“sname”).disabled = false;
}
}
None of it fires not even the window alert. Please can you review & see why it’s not working? Thank you