i use a PDatepicker for pick jalali date .i use $(document).on('change', function() for ajax and when i choose different date function dont work .

<input type="text" class="expire" id="expire"/>
<input type="text" class="x" id="x"/>
<input type="text" class="xx" id="xx"/>
<input type="text" class="xxx" id="xxx"/>

$(".expire").pDatepicker({
                altFormat: "YYY MMMM DD",
                observer: false,
                format: 'L',
                autoClose: true,
            });
            $(document).on('change', function() {
               console.log('ok');
            });

1 Answers

0
PALLAMOLLA SAI On

If you want to call any function after every time date is changed or selected you can do like below.

pDatepicker docs

<link type="text/css" rel="stylesheet" href="persian-datepicker.css" />
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> 
  </script>
  <script type="text/javascript" src="persian-datepicker.js"></script>
  <script type="text/javascript" src="persian-date.js"></script>


<script type="text/javascript">
    $(document).ready(function() {
          $(".example1").pDatepicker({
              altFormat: "YYY MMMM DD",
              observer: false,
              format: 'L',
              autoClose:true,
              onSelect:function(){
                 console.log("hello Worlddd !!")
              }
           });
        });
</script>

<!-- Body-->
<input type="text" id="demo" class="example1" placeholder="select date" />