2

I have used input type text field and attach zebra date picker to it, now how I can call my function(updateDates()) on onchange event?

Without zebradatepicker I am able to use updateDates() function..

$('#tripDate1').val(formattedDate).attr("min", formattedDateMin).Zebra_DatePicker({ direction: 1 });  

<input id="tripDate1" style="margin-left: 3px;" type="text" onkeypress="return false" onkeydown="return false" onchange="updateDates(this.id)" />
seenukarthi
  • 8,241
  • 10
  • 47
  • 68
saad
  • 21
  • 1
  • 3

2 Answers2

1

Try with onSelect function and define it in Javascript.

<script type="text/javascript">    
$(function() {
        $('#tripDate1').datepicker( {
            onSelect: function() {
                updateDates(this.id);
            }
        });
    });
</script>

<input id="tripDate1" style="margin-left: 3px;" type="text" />
Sapikelio
  • 2,594
  • 2
  • 16
  • 40
  • ouch, that's awful. bind with events instead of using `onkeypress`, `onkeydown`, etc... in HTML. – Raptor Jul 31 '15 at 06:46
1

Zebra Datepicker has event listeners which includes the onSelect. See example below.

$(function() {
    $("#tripDate1").Zebra_DatePicker({
        format: 'm/d/Y', //Ensures format consistency
        onSelect: function() {
            //Call your update function here.
        }
    });
});
Ikelie Cyril
  • 130
  • 7