Is there any difference between placeholder and value attribute? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Is there any difference between placeholder and value attribute?

For example; āœ”placeholder <inputĀ type="text"Ā id="fname"Ā name="fname" Ā placeholder="John"> āœwill display John in the text area āœ”Ā value Ā <inputĀ type="text"Ā id="fname"Ā name="fname" Ā value="John"> āœWill display John in the text area

16th Jan 2021, 6:50 AM
Mau'Kauba Nibabe
Mau'Kauba Nibabe - avatar
3 Respostas
+ 1
Hi Mau'Kauba Nibabe you could have tried it first by yourself before posting the question and then answering it. This post will be reported under the offence "self-answer". It might as well be removed.
16th Jan 2021, 5:42 PM
Avinesh
Avinesh - avatar
+ 1
āœHi Avinesh, I tried it and didn't realize the difference so I post the question. šŸ™Then I waited for people to answer but no one did. āœ”So I went back and tried doing it again, and then I realized the difference.
16th Jan 2021, 9:17 PM
Mau'Kauba Nibabe
Mau'Kauba Nibabe - avatar
0
āœGot it: āœ”TheĀ valueĀ attribute puts actual content inside of a form, so if you want to change it you have to delete it first. āœ”While theĀ placeholderĀ attribute puts an image of content inside of a form, so when you click on the box and start typing it disapears. āœ” Placeholder is used more so to specify what the input box is for, were as theĀ valueĀ will give a default value.
16th Jan 2021, 7:01 AM
Mau'Kauba Nibabe
Mau'Kauba Nibabe - avatar