Online Forum To Support Coders With Technical Assistance - Read Write Execute

Difference between Placeholder and Value

Aman Agrawal
Aman Agrawal
Published on November 9, 2015 · 1 min read

While using input tag in HTML form we use two common attributes that are value and placeholder.

If as seen from user perspective these two seems to be same , because while entering the data these two attributes are actually the content which are already written in form before user.

e.g. :-

<input type="text" value="Alok"/>

<input type="text" placeholder="Alok"/>

The value attribute define the default value of input. If user does not give any input then this default value would be considered as input while the placeholder is just the dummy text which shows or depicts that what type of text is to be input in the field.If for any input tag value attribute is not defied and only placeholder is defied then if user is not giving any input will be considered as blank.

Was this article helpful?
Aman Agrawal

Aman Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article how to add border in the table row? Next Article → What is cUrl