Created
May 19, 2015 17:47
-
-
Save AndrewEddy/683864556e8e37f15fba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>HTML Form</title> | |
| </head> | |
| <body> | |
| <form> | |
| <p>First Name:</p> | |
| <input type="text" name="firstname" placeholder="First Name"> | |
| <p>Last Name:</p> | |
| <input type="text" name="lasttname" placeholder="Last Name"><br> | |
| <textarea name="content"></textarea> | |
| <p>Select your favorite fruit.</p> | |
| <select name="fruit"> | |
| <option value="apple">Apple</option> | |
| <option value="apple">Strawberry</option> | |
| <option value="apple">Kiwi</option> | |
| <option value="apple">Watermelon</option> | |
| </select> | |
| <input type="submit"> | |
| </form> | |
| </body> | |
| </html> |
Good
gud
okok
Cool.
why are we giving value up here option value="apple">Apple</option
what happen if we lave it as option value="">Apple</option .?
the value attribute is for the developer. think of it like this, we are displaying the name apple there and as we assign a value to it, we are saying to the parser that, if they select apple, the value should be "apple" and this value will be later used for further processing. And if we do as you asked and leave the value null or "" even if we select apple in the checkbox, there will be no further action that can be taken with your option.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have to copy the name of value to the name you want to display like in first the apple you have value apple also the text is apple for second we should have strawberry as value and the text as well