标签:nbsp box show class else a20 网易 cli value
<!doctype html><html> <head> <meta charset="utf-8"> <title>JS/Jquery复选框控制多个对应div的显隐</title> <script type="text/javascript" src="jquery-1.11.3.min.js"></script> </head> <style type="text/css"> .shows{ display: none; } </style> <body> <input type="checkbox" value="dd1" />淘宝<br /> <input type="checkbox" value="dd2" />新浪<br /> <input type="checkbox" value="dd3" />网易<br /> <input type="checkbox" value="dd4" />天猫<br /> <div id="dd1" class="shows">淘宝</div> <div id="dd2" class="shows">新浪</div> <div id="dd3" class="shows">网易</div> <div id="dd4" class="shows">天猫</div> <script type="text/javascript"> $(":checkbox").each(function () { $(this).click(function () { if ($(this).attr("checked") == "checked") { $("#" + $(this).val()).hide(); $(this).attr("checked",false); } else { $("#" + $(this).val()).show(); $(this).attr("checked",true); } }); }); </script> </body> </html>
______________
JS/Jquery根据复选框的<checked属性>控制多个对应div的显示/隐藏
标签:nbsp box show class else a20 网易 cli value
原文地址:http://www.cnblogs.com/cuizhenyu/p/7422663.html