[英]HTML JavaScript- how to empty contents of div which holds local storage
我如何清空div = history的內容。 單擊“清除”按鈕后,此div用於顯示本地存儲,我想清除該頁面。 誰能告訴我?
<button onclick="click_button_clear()">Clear</button>
<div id="history"></div>
function click_button_clear() {
window.localStorage.clear();
}
已排序
function click_button_clear() {
jQuery("#history").empty();
}
如果可以使用jQuery,否則:
function click_button_clear() {
document.getElementById(history).innerHTML = "";
}
您可以在Jquery中執行以下操作:
function click_button_clear()
{
$('#history').html('');
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.