0
What does placeholder attribute do?
What does placeholder attribute do in HTML? How is it different from using name + type attribute when creating forms? HTML course doesn’t mention placeholder at all but it’s a code repo task so I’m confused.
2 ответов
+ 1
As the name says, it is a placeholder, that means it displays a hint for the user.
Whenever you want to know more about a html tag, you can google it.
https://www.w3schools.com/TAGS/att_input_placeholder.asp
+ 1
Here is 3 inputs,
First is just type text,
Second have placeholder
Third have value
With javascript we can use value of input and for example send to backend/database.
Or do something with this data in our aplication. This value attribute is updated when user type something in field.
If you need to show user what to type in some input field, you can use placeholder or <label> tag, it also help screen readers and search engine to understand for what is this input for.
https://code.sololearn.com/WH5BP2NaQccH/?ref=app