I'm trying to call different javascript functions to run in my html from the selection of radio buttons. I currently have 3 buttons and I want them to run after a button is clicked.
My current HTML is:
<button class="button" onclick="runScript();">Run</button>
<input name="radioButton" type="radio" value="1"> Option 1
<input name="radioButton" type="radio" value="2"> Option 2
<input name="radioButton" type="radio" value="3"> Option 3
I want all 3 options to run separate functions, such as if value="1" then run function 1, etc. It's not a lot but as for my javascript I currently have:
function runScript() {
var x = document.getElementsByName("radioButton").value;
}
Any ideas on how I can get the functions to run like this?