How can we add placeholder in apex input date field?

html-placeholder and placeholder is not working in date field.

1 Answer 1


Unfortunately, we can't.

According to the Visualforce Developer Guide, apex:input actually renders as html input:

<apex:input value="{!inputValue}" id="theTextInput"/>

The example above renders the following HTML:

<input id="theTextInput" type="text" name="theTextInput" />

I tried looking in the HTML Living Standard documentation to see if there is a solution for this and found the following in regards to input of type date:

The following content attributes must not be specified and do not apply to the element: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, multiple, pattern, placeholder, size, src, and width.

That's why html-placeholder attribute did not work in this case.

As a workaround I would use labels instead of placeholders.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .