I have three radio buttons. Each has a value (1, 2 or 3). Under the radio buttons, I need a number to appear that matches the value of the radio button currently selected. This must update in real time.
Currently I have something like this:
<input type="radio" Id="case" value="1" checked>
<input type="radio" Id="case" value="2">
<input type="radio" Id="case" value="3">
<script>
document.write(document.getElementById("case").value);
</script>
When the page is loaded, the javascript runs once, and prints "1". I want this number to change when I select another radio button, but I'm not sure how to do that. I'm flexible in solutions, does not have to be in javascript... any suggestions would be appreciated. I'm using Rails.