以下二種方法是可以為input添加disabled屬性的方法:
網(wǎng)站建設哪家好,找創(chuàng)新互聯(lián)建站!專注于網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、小程序制作、集團企業(yè)網(wǎng)站建設等服務項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了天臺免費建站歡迎大家使用!
//兩種方法設置disabled屬性
$('#areaSelect').attr("disabled",true);
$('#areaSelect').attr("disabled","disabled");
以下三種方法是移除(去除)掉input的disabled屬性的方法:
//三種方法移除disabled屬性
$('#areaSelect').attr("disabled",false);
$('#areaSelect').removeAttr("disabled");
$('#areaSelect').attr("disabled","");
有兩個方法可以刪除元素:
remove 刪除被選元素(及其子元素)
empty 從被選元素中刪除子元素
jQuery removeProp()用來刪除由.prop()方法設置的屬性集
var $para = $("p");
$para.prop("luggageCode", 1234);
$para.append("The secret luggage code is: ", String($para.prop("luggageCode")), ". ");
$para.removeProp("luggageCode");
$para.append("Now the secret luggage code is: ", String($para.prop("luggageCode")), ". ");
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é)點,該方法不會把匹配的元素從 jQuery 對象中刪除,因而可以在將來再使用這些匹配的元素。
4、但除了這個元素本身得以保留之外,remove不會保留元素的 jQuery 數(shù)據(jù),其他的比如綁定的事件、附加的數(shù)據(jù)等都會被移除。
分享名稱:jQuery刪除元素屬性,jq刪除元素的方法
分享網(wǎng)址:http://aaarwkj.com/article48/dssgphp.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、軟件開發(fā)、電子商務、網(wǎng)站營銷、標簽優(yōu)化、網(wǎng)站內鏈
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)