-
-
Save AndrewEddy/683864556e8e37f15fba to your computer and use it in GitHub Desktop.
| <!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> |
why are we giving value up here
option value="apple">Apple</optionwhat happen if we lave it as
option value="">Apple</option .?
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
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.
how can we make radio buttons required using html5