use*_*638 19 html javascript checkbox jquery
我试图在用户点击复选框时隐藏div,并在用户取消选中该复选框时显示该div.HTML:
<div id="autoUpdate" class="autoUpdate">
content
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
<script>
$('#checkbox1').change(function(){
if (this.checked) {
$('#autoUpdate').fadeIn('slow');
}
else {
$('#autoUpdate').fadeOut('slow');
}
});
</script>
Run Code Online (Sandbox Code Playgroud)
我很难让这个工作.
gdo*_*ica 41
确保使用该ready活动.
码:
$(document).ready(function(){
$('#checkbox1').change(function(){
if(this.checked)
$('#autoUpdate').fadeIn('slow');
else
$('#autoUpdate').fadeOut('slow');
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
82950 次 |
| 最近记录: |