admin管理员组文章数量:1356549
I have below piece of code, which, when tested, does not work in IE8. I have it running on IE11 and Chrome and it runs perfectly. I have debugged the code in IE8 which points at "console.log as a problem area. The most interesting thing is that when I start debugging JS in IE8 - it kicks it and this piece of code start working. Then again, on leaving debugging, closing and re-opening file - same story until you get into debugging))).
jQuery(function () {
$('.Response input[type=radio]').change(function () {
console.log(this.value)
if (this.value == 'Y' || this.value == 'NA' || this.value == 'NS') {
$(this).closest('.ui-accordion-content').prev().css("background", "#AADDB2");
} else if (this.value == 'N') {
$(this).closest('.ui-accordion-content').prev().css("background", "#FFC5C5");
}
});
});
Any ideas? Would appreciate yr help. PS. Unfortunately, user kind of "must" use IE8 and upgrading is not an option(((. Thank you in advance)))
I have below piece of code, which, when tested, does not work in IE8. I have it running on IE11 and Chrome and it runs perfectly. I have debugged the code in IE8 which points at "console.log as a problem area. The most interesting thing is that when I start debugging JS in IE8 - it kicks it and this piece of code start working. Then again, on leaving debugging, closing and re-opening file - same story until you get into debugging))).
jQuery(function () {
$('.Response input[type=radio]').change(function () {
console.log(this.value)
if (this.value == 'Y' || this.value == 'NA' || this.value == 'NS') {
$(this).closest('.ui-accordion-content').prev().css("background", "#AADDB2");
} else if (this.value == 'N') {
$(this).closest('.ui-accordion-content').prev().css("background", "#FFC5C5");
}
});
});
Any ideas? Would appreciate yr help. PS. Unfortunately, user kind of "must" use IE8 and upgrading is not an option(((. Thank you in advance)))
Share Improve this question asked Feb 28, 2014 at 18:34 AlexShevyakovAlexShevyakov 4237 silver badges21 bronze badges 2- 1 IE8 chokes on console mands unless the dev tools are open. – j08691 Commented Feb 28, 2014 at 18:36
- 2 stackoverflow./questions/690251/… – j08691 Commented Feb 28, 2014 at 18:37
2 Answers
Reset to default 7you can prevent ie8 errors on console.log with
if (!window.console){ console = {log: function() {}} };
You can add some safety code to define console
if it doesn't exist:
if (typeof console === "undefined" || typeof console.log === "undefined") {
console.log = function(log_message) {
alert(log_message);
};
}
本文标签: javascriptConsolelog in IE8Stack Overflow
版权声明:本文标题:javascript - Console.log in IE8 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743973112a2570768.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论