Hide popup when clicking outside

//show popup when clicking the trigger
$('#trigger').on('click touch', function(){

//hide it when clicking anywhere else except the popup and the trigger
$(document).on('click touch', function(event) {
  if (!$(event.target).parents().addBack().is('#trigger')) {

// Stop propagation to prevent hiding "#tooltip" when clicking on it
$('#tooltip').on('click touch', function(event) {


Leave a Reply

Your email address will not be published. Required fields are marked *

65 + = 66