HTML Text Field Code

How to create a text field with default value in it?
How to set text field size in html?
How the make the text field form non-editable?

Explanation

Text Fields
Example :
<form name=myText>
<input type="text" name=myText value="Enter Your Name">
</form>
Result :
Definition:
A form should always begin and close with a "form" tag. The attribute "name" for form tag may be defined (e.g "name=myform"). However the name will be required only during form action's which will require php or any other server side scripting language. So we will see those things in our php tutorials.
Here we define the text field using "input" tag. we give a attribute called "TYPE=TEXT" inside the tag, which defines the type as a text field. The attribute "name" for input tag may be defined. The value which we want to be displayed in the textfield should be given using the attribute "value"( e.g: value=Enter)
Text Fields Size
We can set the size of the text field using the attribute "SIZE" as 'size=50'
Example :
<input type="text" name=myText value="Enter Your Name" size=50>
Result :

Non Editable Text Field
We can make a text field non editable or readonly (i.e user cant edit the filed) using the entry "readonly".
Example :
<input type="text" name=myText value="Enter Your Name" readonly>
Result :

Ask Questions

Ask Question