What's the difference between the two?
placeholder vs. data-placeholder?
They both seem to produce the same results.
<select data-placeholder="Enter name">
<select placeholder="Enter name">
What's the difference?
(Which one's stronger?)
Attribute placeholder
is a standard HTML5 attribute and data-placeholder
is just data-
HTML5 attribute used by some javascript plugin.
Without the external js plugin, data-placeholder
does nothing while placeholder
works with the only requirement of having HTML5 support on client browser.
They can't possibly produce the same results. placeholder
is part of the HTML5 spec to show placeholder text in the field before anything is typed, while data-*
is just generic data attached to the element.
You might have some JavaScript polyfill or something on the page that uses data-placeholder
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With