Datepicker in Ajax Modal Pop Up -
i using modal popup on click call form ajax, issue datepicker not working in modal pop + ajax form
here code
html :
<a href="#" data-toggle="modal" data-target="#myid" class="pickupclass">add</a> <div class="modal fade" id="myid" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <form class="form-horizontal form-bordered" method="post" id="form2"> <div class="modal-body"> <div class="panel-body panel-body-nopadding cancelform" style="max-height:400px; overflow:auto;"> </div> </form> </div> </div>
ajax code calling form
$('a.pickupclass').click(function(){ $.ajax({ type: "post", url: "ajax.php", // success: function(msg){ $(".form2").html(msg); }, error: function(){ //alert("failure"); } }); });
ajax.php
<input type="text" class="form-control" name="pickupdate" id="pickupdate" required>
when call ajax.php directly, datepicker works , calling through ajax function datepicker not working..
what can do..??
if want add new bootstrap-datepicker
, must initialize input should datepicker calling .datepicker()
on it.
change ajax callback function to:
success: function(msg){ $(".form2").html(msg); $('#pickupdate').datepicker({ //options object }); }, ...
Comments
Post a Comment