我想让一个 div 用 jquery 和 css 显示和消失。代码不起作用:
HTML
<html>
<head>
</head>
<body>
<div class="box" id="b1">
<a href="#">click to show content</a>
<div class="content">
here is content here is content here is content
<div class="button" id="b2">remove content</div>
</div
</body>
</html>
jQuery
$(document).ready(function() {
$('#b1').click(function() {
$('.content').css({
"display": "block"
});
});
$('#b2').click(function() {
$('.content').css({
"display": "none"
});
});
});
演示:http: //jsfiddle.net/jTgRF/41/