Vote count:
0
I don't know why this code won't work but when I check the checkbox it won't work. The div just remains hidden. I have done this before but this time it won't work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://ift.tt/mOIMeg">
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="WebPartPageExpansion" content="full" />
<meta charset="utf-8">
<title>jQuery Show Hide Using Checkboxes</title>
<script type="text/javascript" src="../SiteAssets/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('input[type=checkbox]').change(function(){
var checked = $(this).attr('checked');
if (checked) {
$('.other').show();
} else {
$('.other').hide();
}
});
});
</script>
</head>
<body>
<div name="main">
<input type="checkbox" /> If this is checked display div
</div>
<div class='other' name='other' title='other' style='display:none;'>
<h2>test</h2>
<input></input>
<input></input>
<input></input>
</div>
</body>
</html>
What am I doing wrong? I can't figure this out. Thanks.
asked 56 secs ago
How can I show a div if checkbox is ticked on Sharepoint designer?
Aucun commentaire:
Enregistrer un commentaire