Javascript 在jquery函数中从日历中获取所选日期
Hi希望通过从完整的月历中选择日期来显示在特定日期创建的任务 此日期创建了多个任务。为此,我想触发一个jquery事件,它将根据该日期获取数据并返回 但我的问题是,我需要选择的日期,以便可以在node js函数中传递它Javascript 在jquery函数中从日历中获取所选日期,javascript,jquery,html,css,Javascript,Jquery,Html,Css,Hi希望通过从完整的月历中选择日期来显示在特定日期创建的任务 此日期创建了多个任务。为此,我想触发一个jquery事件,它将根据该日期获取数据并返回 但我的问题是,我需要选择的日期,以便可以在node js函数中传递它 $('#calendar').datepicker({ onSelect: function(date, datepicker) { // date is the selected date as a string // datepick
$('#calendar').datepicker({
onSelect: function(date, datepicker) {
// date is the selected date as a string
// datepicker is the instance of the calendar itself
}
});
如何获取所选日期的任何帮助
我在用这个日历
<link rel="stylesheet" type="text/css" href="pages/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
<script src="pages/bower_components/jquery/dist/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<div class="box box-primary">
<div class="box-body no-padding">
<!-- THE CALENDAR -->
<div id="calendar"></div>
</div>
</div>
jQueryUI-Datepicker有一个选项
onSelect
,您可以将该选项作为属性传递给options
对象,该对象可以传递给.Datepicker
函数
$('#calendar').datepicker({
onSelect: function(date, datepicker) {
// date is the selected date as a string
// datepicker is the instance of the calendar itself
}
});
在那里,您可以从Node.js服务中获取所需的数据,并使用它来可视化为该日期计划的任务
jQueryUI日期选择器小部件的文档:阅读文档,你甚至可以找到一种方法来选择多个日期
我希望这对您有所帮助。您使用的是哪个插件?我编写了此代码,但如果没有触发此事件,则会触发此事件。不工作请用你写的代码更新你的帖子。我在CodePen中测试了它,它的工作原理与预期完全一致。谢谢,它正在工作。问题是js文件与其他js文件冲突