Bootstrap popover (pop up box) 2 seconds after the timing of the disappearance of the implementation code
- 2021-07-24 09:52:52
- OfStack
Bootstrap Popover (pop-up box) is created using a custom Jquery plug-in. It can be used to display some information about any element.
First, a small prompt pops up in the target DOM structure, and then the prompt disappears after 2 seconds
<input type="text" class="form-control" id="tableName" placeholder=" Please enter a form name " data-toggle="tooltip" data-placement="top">
<script>
function showPopover(target, msg) {
target.attr("data-original-title", msg);
$('[data-toggle="tooltip"]').tooltip();
target.tooltip('show');
target.focus();
//2 Disappear prompt box after seconds
var id = setTimeout(
function () {
target.attr("data-original-title", "");
target.tooltip('hide');
}, 2000
);
}
showPopover($("#tableName")," Table name already exists ");
</script>