I'm working on a form for my website and I have two input fields which are dates. I wanted to have a particular placeholder, so this is how I achieved that:
<label for="check-in" id="check-in-label"></label>
<input type="text" placeholder="Check In" id="check-in" name="check-in" class="form-control" onfocus="(this.type='date')">
<label for="check-out" id="check-out-label"></label>
<input type="text" placeholder="Check Out" id="check-out" name="check-out" class="form-control" onfocus="(this.type='date')">
However, I also added svgs to those input fields, so I realized I needed to get rid of the default calendar icon that the "date" type comes with. I achieved this with CSS:
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
}
This works as it deletes the icon however, I would still like to have the calendar pop up without the icon.
So this is what it looks like now:
And when I click on the input field, this is what I get:
I would like it for to appear like this once you click on the input field but without the default icon:
How can I achieve this? Thank you in advance!
I tried to do this with CSS:
input[type="date"]::-webkit-calendar-picker-indicator {
background: transparent;
bottom: 0;
color: transparent;
cursor: pointer;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
width: auto;
}
and it causes only ONE of the input fields to show the calendar without the icon however it requires a double click and also makes the calendar not go away regardless of clicks.