我一直在試圖得到這個照顧,並且它似乎並不想工作。我搜索了互聯網和stackoverflow的答案,但我似乎無法找到任何實際的工作。如果任何人都可以幫助我,那太棒了!爲什麼這個JQuery內部html集合不起作用?
<html>
<head>
<script rel="javascript" type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">
$(document).ready(function(){
$(".box").html("sing!!!!");
});
</script>
<style>
.box{
border:2px solid black;
padding:12px;
}
</style>
</head>
<body>
<div class="box">
This will be replaced with a JQuery statement.
</div>
<p>
This is text to be left UNALTERED.
</p>
</body>
</html>
這可能是因爲你正在加載jQuery庫和聲明腳本語句在一個標籤。請參閱http://stackoverflow.com/questions/6528325/what-does-a-script-tag-with-src-and-content-mean – 2013-03-09 18:02:44
附註:'script'標籤沒有'rel'屬性,而' type'屬性默認爲'text/javascript',所以你應該把'rel'完全關閉,如果你喜歡(如果你使用的是JavaScript),你可以*關閉'type'。 – 2013-03-09 18:10:42