Is it possible to use the value attribute and the placeholder attribute in an html input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to use the value attribute and the placeholder attribute in an html input?

2nd Nov 2023, 7:41 PM
Amin Takhsideh
Amin Takhsideh - avatar
2 Answers
+ 6
Yes, you can use both. The placeholder is shown only when the value is empty, but it can still make sense if the user actually deletes the text that was initially provided as value. Also, you can easily try this in the code playground. Feel free to experiment with it at your leisure!
2nd Nov 2023, 8:35 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Yup!
3rd Nov 2023, 12:33 PM
Alhaaz
Alhaaz - avatar