求js代码,三个复选框选项,选中一个复选框后面弹出对应的下拉框,选中两个复选框要出现两个对应的下拉框

如题所述

第1个回答  2019-07-29

<!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>

本回答被网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网