Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 input type time without AM-PM and with min-max

Tags:

html

jquery

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

like image 786
Axon Avatar asked Jul 24 '17 14:07

Axon


People also ask

How do I limit time in HTML?

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.

How do I add AM PM to input type time?

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 */ .


1 Answers

.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"  />
like image 53
Eng_Farghly Avatar answered Sep 30 '22 03:09

Eng_Farghly