jquery操作checkbox逆選択機能を実現
1299 ワード
, , ,
<html>
<head>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(":checkbox").each(function () {
if ($(this).attr("checked")==false) {
$(this).attr({checked:true});
}
});
});
</script>
</head>
<body>
<input type="checkbox" name="toilet" id="toilet1" value=" "> 1</input>
<input type="checkbox" name="toilet" id="toilet2" value=" "> 2</input>
<input type="checkbox" name="toilet" id="toilet3" value=" "> 3</input>
<input type="checkbox" name="toilet" id="toilet4" value=" "> 4</input>
<input type="checkbox" name="toilet" id="toilet5" value=" "> 5</input>
</body>
</html>