Hermes Hermes - 5 months ago 66
Javascript Question

Zebra datepicker select event

I'm using Zebra Datepicker I want to get selected value when the input value changed. But my code doesnt work. Please help me!.

<input type="text" class="datepicker" id="date1" value="Select First Date"/>
<input type="text" class="datepicker" id="date2" value="Select Last Date"/>
$(document).ready(function() {
$("input.datepicker").Zebra_DatePicker({ dateFormat: "dd-mm-yy" });
});
$("#date1").Zebra_DatePicker({
onSelect: function() {
$(this).change();
alert("x");
}
});

Answer

If I've understood the problem, this could be the solution

    $(document).ready(function() {
    $(".datepicker").Zebra_DatePicker({ format: "d-m-y" }); 
 });
    $("#date1").Zebra_DatePicker({

          format: "d-m-y" ,
      onSelect: function() { 
        $(this).change();
        alert($(this).context.value);
      }
    });