你好!

成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比鼓樓網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式鼓樓網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋鼓樓地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。
清空本地存儲的數(shù)據(jù),是全部清除還是部分清除?
刷新頁面可以在$(function(){...})進(jìn)行處理.
$(function(){
//如果清除localStorage中存儲的所有數(shù)據(jù)?使用clear()方法
localStorage.clear();
//如果清除localStorage中存儲的指定數(shù)據(jù)?使用removeItem("key")方法
localStorage.removeItem("鍵名");
.....
});
希望對你有幫助!
html 片段
table id = "test"
thead
trtd列1/tdtd列2/tdtd列3/tdtd列4/td/tr
/thead
tbody
trtd1/tdtd1/tdtd2/tdtd3/td/tr
trtd2/tdtd4/tdtd5/tdtd6/td/tr
trtd3/tdtd7/tdtd8/tdtd9/td/tr
trtd4/tdtd1/tdtd2/tdtd3/td/tr
/tbody
/table
input type="button" id="btn" value="清空"
js片段
$(function(){
$("#btn").click(function() {
$("#test tbody").html("");
});
});
$(':input','#myform')
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected')
基本包含所有情況。
1、可以這樣做:1234window._obj = '張三';//定義對象,這時候有了一個對象_objconsole.log,控制臺輸出對象:張三delete window._obj;//刪除對象nameconsole.log(window._obj);//控制臺輸出:Undefind,1$('#your_id').remove。
2、$(document).ready(function(){ $(".tab1_tag1_con a").click(function(){ var $abca=$(this).html(); var $parent = $(".tab1_tag2_con"); var $parentlen=$(".tab1_tag2_con").children("a").length; alert('a href="javascript:void(0)"'+$abca+'/a'); if ($parentlen9) { $parent.append('a href="javascript:void(0)"'+$abca+'/a'); } else { alert("不能添加超過10個"); } }); $(".input_bt7").click(function(){ var $city = $("#input_bt77").attr("value"); var $parent = $(".tab1_tag2_con"); $parent.append($city); }); $(".tab1_tag2_con a").click(function(){ $(this).remove(); }); }); 刪除tab1_tag2_con a里原有的a就可以,但是不能刪除后來添加的a。
3、remove方法移除被選元素,包括所有文本和子節(jié)點(diǎn),該方法不會把匹配的元素從 jQuery 對象中刪除,因而可以在將來再使用這些匹配的元素。
4、但除了這個元素本身得以保留之外,remove不會保留元素的 jQuery 數(shù)據(jù),其他的比如綁定的事件、附加的數(shù)據(jù)等都會被移除。
div class="add"
/div
$(function(){
$(".add").click(function(){
$(this).html("");//清空add里面的數(shù)據(jù);
$(this).html("aa");//aa為要添加的數(shù)據(jù),可以是字符串,也可以是變量;
})
})
新聞名稱:jquery清空數(shù)據(jù),jquery清空html
標(biāo)題路徑:http://chinadenli.net/article31/dsgchsd.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、Google、企業(yè)網(wǎng)站制作、網(wǎng)站制作、外貿(mào)網(wǎng)站建設(shè)、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)