IE8中的Console.log

Ale*_*kov 1 javascript jquery internet-explorer-8 console.log

我有下面的代码,经过测试,在IE8中不起作用.我在IE11和Chrome上运行它运行得很好.我已经调试了IE8中的代码,它指向"console.log作为问题区域.最有趣的是,当我开始在IE8中调试JS时 - 它踢它并且这段代码开始工作.然后再次,在离开调试时,关闭并重新打开文件 - 同样的故事,直到你进入调试))).

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"); 
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?会很感激你的帮助.PS.不幸的是,用户有点"必须"使用IE8并且升级不是一种选择(((.提前谢谢)))

iSc*_*uff 7

你可以在console.log上防止ie8错误

if (!window.console){ console = {log: function() {}} };
Run Code Online (Sandbox Code Playgroud)