Berikut Form Attribut dan
cara penggunaanya :
1. Value
attribute : menentukan nilai awal untuk field input
Contoh :
<form action="">
First name:<br>
<input type="text" name="firstname" value="John">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:<br>
<input type="text" name="firstname" value="John">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
2. Readonly
Attribute : menentukan field inputan hanya dapat dibaca saja
Contoh :
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" readonly>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:<br>
<input type="text" name="firstname" value="John" readonly>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
3. Disabled
Attribute : menentukan field inputan dinonaktifkan
Contoh :
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" disabled>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:<br>
<input type="text" name="firstname" value="John" disabled>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
4. Size
Attribute : menentukan ukuran dalam karakter untuk input field
Contoh :
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" size="40">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:<br>
<input type="text" name="firstname" value="John" size="40">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
5. Maxlength
Attribute : menentukan panjang maksimum yang diperbolehkan untuk input field
Contoh :
<form action="">
First name:<br>
<input type="text" name="firstname" maxlength="10">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
First name:<br>
<input type="text" name="firstname" maxlength="10">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
Attribute untuk tag
<input>:
·
autocomplete
·
autofocus
·
form
·
formaction
·
formenctype
·
formmethod
·
formnovalidate
·
formtarget
·
height and width
·
list
·
min and max
·
multiple
·
pattern (regexp)
·
placeholder
·
required
·
step
Dan attribute lain untuk
tag <form>:
·
autocomplete
·
novalidate
0 komentar:
Posting Komentar