Search code examples
jquerydatedrupal-7

How to change End date on selected event of start date in drupal 7?


I am using date module and i wants to change End date on selected event of start date.

i have checked below code but it is not working.

 $('#edit-line-item-fields-field-event-date-und-0-value-datepicker-popup-0').change(function () {
        var dt = this.val();
  $('#edit-line-item-fields-field-event-date-und-0-value2-datepicker-popup-0').val(dt);

    //OR  
$("#edit-line-item-fields-field-event-date-und-0-value2-datepicker-popup-0").datepicker({ minDate: +1 });   
 });

Solution

  • Try finding out what this refers to (perhaps by using console.log(this)). My guess is that this is a plain HTML element, which will not have the val() method.

    If so, use $(this).val() instead.