我尝试将background-color
放入段落中通过jquery之前我创建div并且有两个按钮显示并隐藏当点击显示div显示时和点击隐藏div是隐藏..所以在此之后我尝试这种背景颜色不可见
检查此代码
<head>
<title></title>
<meta charset="utf-8" />
<script src="jquery-2.2.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnhide").click(function () {
$("#dvmain").hide("slow");
});
$("#btnshow").click(function () {
$("#dvmain").show("slow");
});
});
$document.ready(function () {
$("p").css("background-color", "red");
});
</script>
</head>
<body>
<input type="button" id="btnshow" value="show" />
<input type="button" id="btnhide" value="hide" />
<div id="dvmain" style="width:100%;height:400px;background-color:red;">
</div>
<p>this is paragraph one</p>
<p>this is paragraph two</p>
<p>this is paragraph three</p>
</body>
任何解决方案?
答案 0 :(得分:1)
像这样替换你的脚本,
$(document).ready(function () {
$("#btnhide").click(function () {
$("#dvmain").hide("slow");
});
$("#btnshow").click(function () {
$("#dvmain").show("slow");
});
$("p").css("background-color", "red");
});
删除此部分
$document.ready(function () {
$("p").css("background-color", "red");
});
答案 1 :(得分:1)
List.sublist