I am making a form field where I would like to do a simple show-hide to display div's on a radio button.
<form id="basic" name="basic"> <label><input name="formelement" type="radio" value="yes" /> Yes </label> <label><input name="formelement" type="radio" value="no" /> No </label> <div id="yes" style="display: none;"> This is the div that displays that shows when 'Yes' is selected. </div> <div id="no" style="display: none;"> This is the div that displays that shows when 'No' is selected. </div> </form> I have played with some various javascript's I have found online and have achieved not a lot of success as most of them online manage to show-hide one div. Getting the 'yes' to hide when 'no' is selected and vice-versa is the tricky part. If anyone could provide some assistance that would be really appreciated!