Hi guys, I have a problem.
I am extracting some values ββfrom the database and I am showing them in an edit form. When editing is done, the values ββwill be sent back to the database.
I want to show a div if the radio is checked with the value "Yes", and if the radio is set to "No", I want to show another div.
The verified value comes from the database, so it is not always on the same radio.
<input type="radio" name="longer" id="Yes" value="Yes" <?=($info['longer']=='Yes')?'checked':''?>>Yes <input type="radio" name="longer" id="No" value="No" <?=($info['longer']=='No')?'checked':''?>>No <div id="first"> Show if value is yes </div> <div id="second"> Show if value is no </div>
This is the jquery code that I have had so far, but it does not work:
$(document).ready(function() { if ($('#No').prop('checked')) { $('#first').hide(); $('#second').show(); } else if ($('#Yes').prop('checked') { $('#second').hide(); $('#first').show(); } });
Thank you for your time.
source share