我試圖刷新div,但它是複製其他所有內容。 在我做任何事之前,頁面看起來像這樣:initial page 第二個按鈕應該是刷新div,但是當我這樣做時,這是我得到的:after trying to refresh, it refreshes it, but duplicates everything else 我該如何使它只刷新div?如何刷新div而不添加
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<br/>
<div id='ff'>something</div>
<input id='input'/>
<button id='btn1'>first</button>
<button id='btn2'>second</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#btn1').click(function(){
var input=$('#input').val();
$('#ff').text(input);
});
$('#btn2').click(function(){
$('#ff').load('thing2.html');
});
});
</script>
</body>
是這個文件的名稱thing2.html? – WEBjuju
我似乎無法複製該問題... [codepen](http://codepen.io/NDfool/pen/gLRvMo?editors=0010) –