[英]How to get the date selected in input type=date in jQuery?
I have an HTML code like this one: 我有一个像这样的HTML代码:
<form action="#" method="get">
<input type="date">
</form>
I want to have an event or something that will check when the date is changed, and get the date in JS Date object? 我希望有一个事件或什么会检查日期何时更改,并在JS Date对象中获取日期?
You need to use a .change() jquery handler it will look something like this: 你需要使用.change()jquery处理程序,它看起来像这样:
$(document).ready(function(){
$('#dateInput').change(function(){
console.log('Updated Date');
});
});
<form>
<input id="dateInput" type="date" />
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.