BeamerEA
BeamerEA

Reputation: 113

Set HTML Date input to default as a string

I am trying to set chart that pulls data based on an input date range, so I want to set the start and end date picker's default values to strings (i.e. "Start" "End" as opposed to "mm/dd/yyyy").

I'm currently setting up the date inputs as follows:

<input style="background-color: #2E2F30; color:white; height: 50px; width: 150px;" type="date" id="StartDateSelect">
<input style="background-color: #2E2F30; color:white; height: 50px; width: 150px;" type="date" id="EndDateSelect">
<button class="btn" style="background-color: #2E2F30; color:white; height: 50px; width: 50px;" id="RefreshButton" onclick="getDates()">></button>

Upvotes: 1

Views: 45

Answers (1)

dev_mustafa
dev_mustafa

Reputation: 1111

Use onfocus attribute

<input type="text" class="form-control" placeholder="Start" onfocus="(this.type='date')"/>

Upvotes: 1

Related Questions