thank you!!!!!!
When selecting a field in the drop-down box, clear the field of the radio button. When selecting a field in the drop-down box, there is no value. A/B
Column 2(radio button) : 1/2/3
Column 3(check box) : a/b/c
When I select A in column 1, I need to display column 2 and column 3 to select the content.
When switching to option B, the hidden selection in field 2 and 3 is cleared and left unselected.
Now is when I finish choosing A and then switch to choosing B. Then click the radio button, selected but can not get the radio button value.
How thecode should be implemented.
0 Answer
thank you!!!!!!
Based on Monster group and GPT:
(using jQuery) :
<select id="select">
<option value="A">Aoption>
<option value="B">Boption>
select>
<div id="radio-group" style="display:none;">
<label><input type="radio" name="radio" value="1">1label>
<label><input type="radio" name="radio" value="2">2label>
<label><input type="radio" name="radio" value="3">3label>
div>
<div id="checkbox-group" style="display:none;">
<label><input type="checkbox" name="checkbox" value="a">alabel>
<label><input type="checkbox" name="checkbox" value="b">blabel>
<label><input type="checkbox" name="checkbox" value="c">clabel>
div>
// JavaScript 代码
$(function() {
// 监听下拉框的变化事件
$('#select').on('change', function() {
var selectedValue = $(this).val();
if (selectedValue === 'A') {
// 显示栏位二和栏位三
$('#radio-group').show();
$('#checkbox-group').show();
} else if (selectedValue === 'B') {
// 隐藏栏位二和栏位三,并清空它们的值
$('#radio-group').hide().find('input').prop('checked', false);
$('#checkbox-group').hide().find('input').prop('checked', false);
}
});
});
这家伙很懒,什么都没留下...