Category: Web-Dev

jQuery click issue on iPhone/iOS

By default jQuery click event does not work in iPhone/iOS devices in Safari/Chrome for a non-anchor element. Ways to fix it: add {cursor:pointer} CSS property to a clickable element; or add onclick="void(0)" HTML attr; And also don't forget href attr for the anchor element, otherwise it will be not trigger click event in iPhone/iOS devices...

Bootstrap 4 hide popover on click outside

$('body').on('click', function (e) { if ($(e.target).data('toggle') !== 'popover' && $(e.target).parents('[data-toggle="popover"]').length === 0 && $(e.target).parents('.popover.show').length === 0) { $('[data-toggle="popover"]').popover('hide'); } });$('body').on('click', function (e) { if ($(e.target).data('toggle') !== 'popover' && $(e.target).parents('[data-toggle="popover"]').length === 0 && $(e.target).parents('.popover.show').length === 0) { $('[data-toggle="popover"]').popover('hide'); } });