Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 <input type=“date”> - onChange Event

Is possible to detect in event onChange for <input type=“date”>, when user using graphical calendar and arrows or using keybord number?

I am only interested in VanillaJS solutions.

like image 286
Piotr Białek Avatar asked Nov 23 '16 10:11

Piotr Białek


People also ask

How can set input type date in mm/dd/yyyy format using HTML?

To set and get the input type date in dd-mm-yyyy format we will use <input> type attribute. The <input> type attribute is used to define a date picker or control field. In this attribute, you can set the range from which day-month-year to which day-month-year date can be selected from.

Which html5 attributes can be used with html5 date input type to limit date selection?

The max attribute specifies the maximum value (date) for a date 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 use Onchange input tag?

Definition and UsageThe onchange attribute fires the moment when the value of the element is changed. Tip: This event is similar to the oninput event. The difference is that the oninput event occurs immediately after the value of an element has changed, while onchange occurs when the element loses focus.


1 Answers

Something like this?

function handler(e){    alert(e.target.value);  }
<input type="date" id="dt" onchange="handler(event);"/>
like image 83
Theodore K. Avatar answered Sep 18 '22 16:09

Theodore K.