HTML Input Attributes

value Attribute

Program on value Attribute

<!DOCTYPE html>
<html>
<body>

<form action=””>
First name:<br>
<input type=”text” name=”firstname” value=”Sara”>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>

</body>
</html>

Output
First name:

Last name:

readonly Attribute

Program on readonly Attribute

<!DOCTYPE html>
<html>
<body>

<form action=””>
First name:<br>
<input type=”text” name=”firstname” value =”Sara” readonly>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>

</body>
</html>

Output
First name:

Last name:

disabled Attribute

Program on Disabled Attribute

<!DOCTYPE html>
<html>
<body>

<form action=””>
First name:<br>
<input type=”text” name=”firstname” value =”Sara” disabled>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>

</body>
</html>

size Attribute

Program on Size Attribute

<!DOCTYPE html>
<html>
<body>

<form action=””>
First name:<br>
<input type=”text” name=”firstname” value =”Sara” size=”28″>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>

</body>
</html>

Output
First name:

Last name:

maxlength Attribute

Program on maxlength Attribute

<!DOCTYPE html>
<html>
<body>

<form action=””>
First name:<br>
<input type=”text” name=”firstname” maxlength=”10″>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>

</body>
</html>

Output
First name:

Last name:

 

Leave a Reply

Your email address will not be published. Required fields are marked *