Properti checked <input> HTML
Definisi dan Penggunaan
checked
Properti menentukan bahwa elemen input harus dipilih sebelum halaman dimuat.
checked
Properti ini adalah properti boolean.
Jika properti ini sudah disetel, ia menentukan bahwa elemen <input> harus dipilih (terpilih) saat halaman dimuat.
checked
Properti dapat digunakan bersama dengan <input type="checkbox"> dan <input type="radio"> dipakai bersama-sama.
checked
Properti dapat disetel setelah halaman dimuat melalui kode JavaScript.
Contoh
Form HTML dengan kotak centang yang terpilih:
<form action="/action_page.php"> <input type="checkbox" name="vehicle1" value="Bike"> <label for="vehicle1">Saya punya sepeda</label><br> <input type="checkbox" name="vehicle2" value="Car"> <label for="vehicle2">Saya punya mobil</label><br> <input type="checkbox" name="vehicle3" value="Boat" checked> <label for="vehicle3">Saya punya kapal</label><br><br> <input type="submit" value="Kirim"> </form>
Sintaks
<input checked>
Dukungan browser
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Dukungan | Dukungan | Dukungan | Dukungan | Dukungan |