Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery Datetimepicker XDsoft:如何从内联日历中获取值?_Javascript_Jquery_Datepicker - Fatal编程技术网

Javascript jQuery Datetimepicker XDsoft:如何从内联日历中获取值?

Javascript jQuery Datetimepicker XDsoft:如何从内联日历中获取值?,javascript,jquery,datepicker,Javascript,Jquery,Datepicker,我使用XDSoft的jQuery Datetimepicker插件: 我把日历在线显示。下面是我的代码: HTML: <input type="text" id="start_date"> jQuery('#start_date').datetimepicker({ format:'d.m.Y H:i', inline:true }); 我的问题是:当我在前端选择一个日期时,输入字段没有将所选日期作为值。我需要进行哪些更改或添加哪些内容?从Onchange事件中获取值 试

我使用XDSoft的jQuery Datetimepicker插件:

我把日历在线显示。下面是我的代码:

HTML:

<input type="text" id="start_date">
jQuery('#start_date').datetimepicker({
  format:'d.m.Y H:i',
  inline:true
});

我的问题是:当我在前端选择一个日期时,输入字段没有将所选日期作为值。我需要进行哪些更改或添加哪些内容?

Onchange事件中获取值

试试这个

onChangeDateTime:function(dp,$input){
            $('#datePickValue').text($input.val());
        }
完整代码如下所示

jQuery('#start_date').datetimepicker({
  format:'d.m.Y H:i',
  inline:true,
  onChangeDateTime:function(dp,$input){
    $('#start_date').text($input.val()); // change the div as per your need - change the text as val ( it depends on the field)
  });
试试这个..它对我有用,所以对你也应该有用..快乐编码..

使用

HTML

<input type="hidden" id="start_date">

$(“#日期时间选择器”).val();请看:我可以使用Y-m-d格式作为这个插件。据我所知,这种格式不起作用[它与Y/m/d和Y.m.d一起工作]
<input type="hidden" id="start_date">
var $startDate = $('#start_date');

$startDate.datetimepicker({
  inline:true,
  sideBySide: true
});

$startDate.on('dp.change', function() {
  var selectedDate = $(this).val();
  alert(selectedDate);
});