Is there any difference between placeholder and value attribute? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answers
+ 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