我需要設置background-color屬性到整個身體,但我的代碼似乎不工作 我學習jQuery的,但我仍然是一個新手集background-color屬性在整個文檔
我使用的選擇該呼叫的 body元素,並應用到它的風格
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.11.1.js">
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
$(this).css("background-color","green");
}
);
</script>
</head>
<body>
<ul id="destinations">
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
<li>Fifth</li>
<li class="six">Sixth</li>
</ul>
<p>This is another parragraph</p>
<p>and this is another more</p>
</body>
</html
>
據我所知,你在學習jQuery的,但如果你想設置背景的身體,最好使用CSS。通過jQuery實際*需要的事情來學習jQuery。 – 2014-11-24 05:37:49