I am working with a filter on page to display different products. I am trying to make it so that when you click a button from an external page, it navigates to the product page and automatically clicks the "organics filter" checkbox and then displays the organic items. This code works in every browser except IE and EDGE. Any ideas what could be wrong? It appears to click the organics checkbox but it does not actually click the submit button for IE and EDGE.
**Update: It works if I put an alert after the window.load function. I think its a timing issue or something. Anyone have any suggestions?
//force organic filter if coming from organics article
$(window).load(function(){
var organicURL = document.referrer;
if (organicURL === "http://www.sampleurl.com") {
$('#organicFilter').trigger('click');
if ($('#organicFilter').is(':checked')) {
$('#submitFilter').trigger('click');
}
}
});