下面的代碼從div的創建,但李的div仍然出現在源,你有什麼我錯過了?:的jQuery的.html()函數
$(document).ready(function(){
var makeLI = $("div").html("<li class='blue'>" +
"Here is a new <li > element.</li>");
$("body").append("<ul>");
$("ul").append(makeLI);
});
的出版物中指出:
導航到該文件在您的瀏覽器中。這些元素被轉換成 爲具有我們想要顯示的文本的元素。
然而,在FF 6 div的依然是:
<div><li class="blue">Here is a new <li > element.</li></div>
------------------完整代碼--------- ---------
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
.blue { color:blue; }
</style>
</head>
<body>
<h1>Rewriting three <div> elements</h1>
<div></div>
<div></div>
<div></div>
</body>
</html>
$(document).ready(function(){
var makeLI = $("div").html("<li class='blue'>" +
"Here is a new <li > element.</li>");
$("body").append("<ul>");
$("ul").append(makeLI);
});
是它只能在FF 6?它不是完成的軟件,也許是因爲如果它只在6。 –