shortysbest Posted March 23, 2011 Share Posted March 23, 2011 ///Hide Search Suggestions if (!$(event.target).hasClass('search')&&!$(event.target).hasClass('search-suggestions')) { $(".search-suggestions").hide(); } This works perfectly in firefox, but it doesn't in safari. Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/ Share on other sites More sharing options...
Adam Posted March 28, 2011 Share Posted March 28, 2011 There's nothing within that code Safari doesn't support... Perhaps it's a problem else-where on the page? Do you have this online so we could take a look? Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193214 Share on other sites More sharing options...
shortysbest Posted March 28, 2011 Author Share Posted March 28, 2011 Well actually it's an odd problem, there is multiple problems with jquery in Safari, only on localhost though, when I put the files onto my webserver they work fine. I'm not sure what the issue could be for this, not a huge ordeal though as I use Firefox for my primary localhost browser to build with. Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193221 Share on other sites More sharing options...
Adam Posted March 28, 2011 Share Posted March 28, 2011 That is odd.. Does this particular snippet work from your remote sever? Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193229 Share on other sites More sharing options...
shortysbest Posted March 28, 2011 Author Share Posted March 28, 2011 Actually that example above didn't work in safari, well not entirely, however I made a new working script that was better and does work in all major browsers. Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193252 Share on other sites More sharing options...
cssfreakie Posted March 28, 2011 Share Posted March 28, 2011 Actually that example above didn't work in safari, well not entirely, however I made a new working script that was better and does work in all major browsers. share it! to help others Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193272 Share on other sites More sharing options...
shortysbest Posted March 28, 2011 Author Share Posted March 28, 2011 $(document).click(function(event) { ////Hide Notifications if($(event.target).parents("div:first").attr("class")=="notifications-container"||$(event.target).parents("div:first").attr("class")=="quick-box"||$(event.target).attr("class")=="notifications") {}else { $(".notifications-container").hide(); } }); This is what I replaced it with which works good. Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193298 Share on other sites More sharing options...
cssfreakie Posted March 28, 2011 Share Posted March 28, 2011 thanks for sharing! Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193309 Share on other sites More sharing options...
Adam Posted March 28, 2011 Share Posted March 28, 2011 I think you could do this a better way. What's the HTML structure that you're trying to work with? Link to comment https://forums.phpfreaks.com/topic/231553-jquery-eventtargethasclass-works-in-firefox-not-in-safari/#findComment-1193360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.