标签:hang jquer nbsp 切换 splay bsp rip cti src
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jquery实现下拉框选中对应的div</title>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
</head>
<body>
<select id="s1">
<option value="0">1</option>
<option value="1">2</option>
</select>
<div id="div1">1</div>
<div id="div2" style="display:none">2</div>
<script type="text/javascript">
$(document).ready(function(){
$("#s1").on("change",function(){
if($(this).val()==0){
$("#div1").show();
$("#div2").hide();
}else{
$("#div1").hide();
$("#div2").show();
}
})
});
</script>
</body>
</html>
标签:hang jquer nbsp 切换 splay bsp rip cti src
原文地址:http://www.cnblogs.com/Yoko-815/p/7512783.html