Posts

Showing posts with the label jquery-delegate

Angularjs+jquery bootstrap-datepicker delegate not firing on first click

Angularjs+jquery bootstrap-datepicker delegate not firing on first click I have tried adding the datepicker dynamically on button click and I have delegated the datepicker click which is not working on the first click its getting fired on the second click the code I have tried are the following $scope.add = function() { var body =angular.element(window.document.body); body.append(` <div class="input-group date"> <input class="form-control input-sm" placeholder="dd/mm/yyyy"type="text"> <span class="input-group-addon"> <span class="fa fa-calendar"></span> </span> </div> `); } $(document).delegate("div.input-group.date", "click", function(){ $(this).datepicker({autoclose: true,orientation:"top"}); }); I couldn't find out the reason, thanks ...