【问题标题】:Date selection problem with JQuery Plugin DATE RANGE PICKERJQuery Plugin DATE RANGE PICKER 的日期选择问题
【发布时间】:2011-11-03 13:01:34
【问题描述】:

我在我的一个项目中使用DATE RANGE PICKER JQUERY plugin。日期框是使用此 HTML 代码呈现的

<span class="datePickUnity" id="arrowDate">
  <input type="text" name="<?php echo $name; ?>" value="<?php echo $inputValue; ?>" id="<?php echo $id; ?>" class="datePickBox" />
  <div class="calendarArrowBox"><img src="<?php echo $dirIMG; ?>/arrow.png" class="calendarArrow" alt="Select Date Range" /></div>
</span>   

我这样调用函数

$(function(){
  $('#dateRange').daterangepicker();
});

然后它起作用了,它将值返回到#dateRange输入框

但是现在当我单击整个跨度标记#arrowDate 时我需要它工作,我使用此代码来完成此操作

$(function(){
  $('#arrowDate').daterangepicker();
});

日期范围选择器弹出,但是当我选择我的日期时,我需要它来将日期插入#dateRange 输入框中,有没有办法做到这一点?

【问题讨论】:

  • 为什么不将点击方法附加到跨度并调用 $('#dateRange').daterangepicker();ž
  • @Senad - 我做了,但它没有显示日期范围选择器
  • @Senad 我做了以下 $(document).ready(function() { $('#arrowDate').click(function() { $('#dateRange').daterangepicker() ; }); });

标签: jquery jquery-plugins


【解决方案1】:

怎么样

$(function(){
  $('#dateRange').daterangepicker();
  $('#arrowDate').click(function (e) {
    if ( !($('#dateRange').is(e.target)) )
      $('#dateRange').click();
    }
  });
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-30
    • 2012-06-30
    • 2023-03-13
    • 1970-01-01
    • 2012-01-11
    • 1970-01-01
    • 2019-07-06
    • 2021-06-17
    相关资源
    最近更新 更多