【发布时间】:2012-02-18 18:28:14
【问题描述】:
In my form there are some radio buttons - when the radio is selected - the div appears, when another one is selected - the div hides.如果有一些错误,提交表单后,页面重新加载并且 div 应该仍然显示(如果选择了收音机)。以下解决方案仅适用于复选框 - 如何使其适用于收音机?
https://stackoverflow.com/a/8406409/1137417
这是我的代码:
$(function(){
$('#Q07_03, #Q07_07, #Q08_03').hide();
// checkboxes
$('#Q07_03').toggle($('#Q07_02').is(':checked'));
$('#Q07_02').click(function() {
$('#Q07_03').toggle(); });
$('#Q07_07').toggle($('#Q07_06').is(':checked'));
$('#Q07_06').click(function() {
$('#Q07_07').toggle(); });
// here code for radio ?
// #Q08_03 is the div to be displayed;
// #Q08_02 is the one that should be selected
})
【问题讨论】:
标签: jquery html toggle reload radio