Latest web development tutorials

jQuery removeProp () metode

jQuery HTML Metode / CSS jQuery HTML Metode / CSS

contoh

Menambah dan menghapus properti bernama "warna" dari:

$("button").click(function(){
var $x = $("div");
$x.prop("color","FF0000");
$x.append("The color 属性: " + $x.prop("color"));
$x.removeProp("color");
});

Coba »

Definisi dan Penggunaan

removeProp () metode untuk menghapus prop () metode set properti.

Catatan: Jangan gunakan metode ini untuk menghilangkan atribut HTML seperti gaya, id diperiksa, atau sejenisnya.Gunakan removeAttr () bukan metode.


tatabahasa

$(selector).removeProp(property)

参数 描述
property 规定要移除的属性的名称。


jQuery HTML Metode / CSS jQuery HTML Metode / CSS