我有一个bootstrap 3 popover。我里面有一个引导日期选择器。我有一些自定义脚本,当您单击弹出式窗口之外的任何位置时,它们会关闭弹出式窗口(以防止一次在视图中出现多个弹出式窗口)。但是,当我单击日期选择器中的日期时,它会关闭我的弹出窗口。我该如何停止。
我在这里发现了几个类似的问题,但似乎没有什么对我有用。
$('.editAirSlot').popover({
html: true,
title: function () {
return $("#popover-head").html();
},
content: function () {
return $("#popover-content").html();
},
delay: {show: 500, hide: 0}
});
``` closes popover if you click outside of popover
$('body').on('click', function (e) {
$('.editAirSlot').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
```HTML
```This dynamically create table calls the popover with the .editAirslot class.
....<tbody data-bind="foreach: airSlots.sort(function(l,r){return l.seatPos > r.seatPos ? 1 : -1})">
<tr class="editAirSlot" data-bind="click: $root.setAirSlotValues">
<td data-bind="style:......
```popover html
<div id="popover-content" class="hide">
<label>Date</label>
<input id="schedDate" class="datepicker form-control" readonly="readonly" placeholder="Date..." data-bind="datePicker: schedDate" type="text">
<label>Rotator</label>
<select id="rotator" class="form-control" data-bind="options:rotatorList, optionsText: function(e){return e.lastName + ', ' + e.firstName}, value: selectedRotator, optionsValue: 'rowguid', optionsCaption: 'Select a Rotator...'"></select>
<label>Remarks</label>
<input id="remark" class="form-control" data-bind="value: remark"/>
<label>Line Number</label>
<select id="numberLine" class="form-control" data-bind="options:lineNumList, optionsText: 'name', value: selectedNumberLine, optionsValue: 'rowguid', optionsCaption: 'Select a Line Number...'"></select>
<label>Seat Pos</label>
<select id="seatPos" class="form-control" data-bind="options:seatPosList, optionsText: 'name', value: selectedSeatPos, optionsValue: 'rowguid', optionsCaption: 'Select a Seat Pos...'"></select>
<button class="btnAdd btn btn-primary" type="button">Add</button>
</div>