Need a simple answer to this as a lot of the ones i have found have been too complex for what I need.
id like some jquery to show a div depending on a radio button selection. So if value 0 is selected, display the div? Many thanks!
<p class="form-element">
<label for="MainContent_radioTerms_0">T&Cs Active</label>
<input id="MainContent_radioTerms_0" type="radio" name="ctl00$MainContent$radioTerms" value="0" />
<label for="MainContent_radioTerms_1">T&Cs Inactive</label>
<input id="MainContent_radioTerms_1" type="radio" name="ctl00$MainContent$radioTerms" value="1" />
</p>
<div class="terms" style="display:none"></div>
$("input[name='ctl00$MainContent$radioTerms']").click(function() {
if($(this).val() == 0)
$("div.terms").show()
else
$("div.terms").hide()
});
$('input:radio').change(function() {
$('div.terms').toggle($(this).val() === '0');
});
if($('#MainContent_radioTerms_0').is(':selected')) {
$('.terms').show();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.