求js代码,三个复选框选项,选中一个复选框后面弹出对应的下拉框,选中两个复选框要出现两个对应的下拉框 10
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.hide{
display: none;
}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
$(function(){
$('.cbx').click(function(){
c = $(this).is(":checked");
t = $(this).attr("target");
if(!c)
$('#o'+t).hide();
else
$('#o'+t).show();
});
})
</script>
</head>
<body>
<input target="1" class="cbx" type="checkbox" value="test1">
<select id="o1" class="hide"><option>1</option></select>
<input target="2" class="cbx" type="checkbox" value="test2">
<select id="o2" class="hide"><option>2</option></select>
<input target="3" class="cbx" type="checkbox" value="test3">
<select id="o3" class="hide"><option>3</option></select>
</body>
</html>