I’m having a jQuery problem which I haven’t seen before. My script hides certain wrappers, and this works in Firefox and Chrome, but not IE. The odd thing is when I open the IE console and refresh the page to see the log, then it works as I expect it too. It ONLY fixes when refreshing with developer tools open though!
Here is a console snippet:
$.get('/help-and-advice/purchase-wizard/product-details/' + product_id, function(data) {
console.log(data);
$.each(data.show, function() {
$.each(this, function(index) {
$('#' + data.show[index]).show();
});
});
$.each(data.hide, function() {
$.each(this, function(index) {
$('#' + data.hide[index]).hide();
});
});
In the console log the wrapper I want hidden is listed within the data.show object too.
IE fails when a console statement is present and the console is not open
Change it to
or comment it out or remember to hit F12 before testing
I have this jsfiddle:
Simple version:
More complex version which handles comma delimited arguments – it does not unpack the objects but can handle one layer of complexity