Open Input type Month calendar by clicking any part of the field

Asked

Viewed 213 times

-1

the calendar only opens by default, by clicking the right arrow, there is some way to open the calendar by clicking anywhere in the field?

<input type='month' value='2018-01'>

  • Hello Guilerme. Your question is very vague. Give a read on this page.

1 answer

0


You can do it using CSS

input[type="month"] {
    position: relative;
}

input[type="month"]:after {
    content: "\25BC"; 
    color: #555;
    padding: 0 5px;
}


input[type="month"]:hover:after {
    color: #bf1400;
}
input[type="month"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    color: transparent;
    background: transparent;
}


input[type="month"]::-webkit-inner-spin-button {
    z-index: 1;
}


 input[type="month"]::-webkit-clear-button {
     z-index: 1;
 }
<input type='month' value='2018-01' class='input-container'>

  • Thank you so much, man! D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.