這件事情很明顯,但我不能看到它雖然看着其他人都面臨着,並得到在計算器解決了非常類似的問題。我希望它跳出你的身體。請幫我弄清楚爲什麼我無法插入(或插入後)現有的元素。的jQuery/insertAfter - 無法插入一個新的元素
我包括我的HTML視圖文件(我用笨)與相關的JavaScript。
與以往一樣,非常感謝。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Afterview</title>
<script src="jquery-1.6.4.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="[email protected]">
<li>
Click for more details.
<a id="[email protected]" class="detailbtn" href="#detail-id">(Details)</a>
</li>
</div>
</body>
</html>
<script type="text/javascript">
var html_string;
$('.detailbtn').each(function(i){
$(this).click(function(){
html_string='<li>hello</li>';
$('[email protected]').insertAfter(html_string).show();
});
});
</script>
謝謝你的解釋。我也讀了一些這方面的內容。非常感激。 – user1072910