I’m trying to make a payment form where user can enter credit/debit card details.
For that I need user to select month and year of expiry of card.
The placeholder of the input date box should show something like this MM/YYYY or MM/YY
<div class="custom-month-input">
<label for="expiry-date" class="month-placeholder">Expiry(MM/YY)</label>
<input type="month" id="expiry-date" name="expiry-date">
</div>
I tried mentioning placeholder in input box and giving it a value, but it didn’t work
2
Answers
Since you’re using the
input type="month"
syntax, I found this:Code snippet from here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/month
This lets the user fill in a number for the date and year, but it’s not entirely intuitive that this is a field in which the user can type numbers.
It doesn’t seem to support a placeholder value, but you can use a default value as an example
Does this work? I’ve added
placeholder = ""
in the code.