d2321
3/20/2020 - 9:12 AM

Click causes opening another element, blur causes closing

jQuery(function($) {
	
/* click on search icon (header menu) */	
if ($(".wrap-search-header").length) {

	$(".wrap-search-header").appendTo("li.search_header");
	
	$('li.search_header').click(function() {
	  $(this).addClass('d_open');
	  
	  $('.wrap-search-header input.orig').focus();
	  
	});

	$(document).on('click touch', function (e) {
		if( $(e.target).closest("li.search_header").length > 0 ) {return false;}
		
		$("li.search_header").removeClass('d_open');
	});		
}
  
});