Latest web development tutorials

HTML DOM Label properti htmlFor

Label Referensi Obyek objek label

contoh

Mengembalikan nilai properti untuk label:

var x = document.getElementById("myLabel").htmlFor;

x Outputnya adalah:

male

Coba »

Definisi dan Penggunaan

Nilai htmlFor set properti atau kembali label untuk properti.

untuk atribut menentukan label yang Anda ingin mengikat elemen bentuk.


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung properti bentuk.


tatabahasa

Kembali sifat htmlFor:

labelObject .htmlFor

Pengaturan properti htmlFor:

labelObject .htmlFor= id

Nilai properti

描述
id label 要绑定的元素的 id。

rincian teknis

Pengembalian: String mewakili label id untuk mengikat elemen.


contoh yang lebih

contoh

Ubah nilai properti nilai label:

document.getElementById("myLabel").htmlFor="newValue";

Coba »


Artikel terkait

Referensi HTML: HTML <label> untuk properti


Label Referensi Obyek objek label