How can i remove the AM=PM
part at this input
<input type='time' min='1:30' max='2:30'>
Also, As you can see i tried to add the min
and max
as the time itself but didn't work, How can i make it work? And it keeps telling me "Enter a valid value"
each time i try to submit it without AM-PM
The max attribute specifies the maximum value (time) for a time field. Tip: Use the max attribute together with the min attribute to create a range of legal values. Tip: To set or return the value of the min attribute, use the min property.
If you want the time with AM & PM, check the first two values, and utilize something like the following: if(FirstTwoNums > 12){ FirstTwoNums -= 12; PM = true;}/*else, PM is false */ .
.without_ampm::-webkit-datetime-edit-ampm-field {
display: none;
}
input[type=time]::-webkit-clear-button {
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
-ms-appearance:none;
appearance: none;
margin: -10px;
}
<!--use step="1" to show seconds-->
<input type="time" class="without_ampm" />
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