The Placeholder and Required Attributes
The PLACEHOLDER attribute
There's quite a neat new attribute you can add to your text boxes called PLACEHOLDER. This is default text that disappears when you click inside a text box. Try the following:
<INPUT TYPE="Submit" VALUE="Contact Us">
Save your work and test the form out in a browser (preferably Opera). When the form first loads you'll see this:
The REQUIRED attribute
If you want a text box to be filled in, you can use the REQUIRED attribute:
<INPUT TYPE="Submit" VALUE="Contact Us">
You just type the word REQUIRED, with no equal sign or text after it.
Test it out in your browser. Don't click inside of your text box, but just click your submit button. In the latest editions of Firefox, you should see something like this:
Friday, 10 July 2015
The Placeholder and Required Attributes
<FORM>
<INPUT TYPE="Text" PLACEHOLDER="Enter your first name">
<P>
</FORM>
The word PLACEHOLDER does not have to be in capitals, as like just about every HTML element it is not case sensitive. After an equal sign, you type the text you want to appear in your text box, surrounded by quotation marks.
<FORM>
<INPUT TYPE="Text" PLACEHOLDER="Enter your first name" REQUIRED>
<P>
</FORM>
0 comments:
Post a Comment