IE11错误-JavaScript函数中应包含标识符、字符串或数字
我编写的JS函数如下所示:IE11错误-JavaScript函数中应包含标识符、字符串或数字,javascript,jquery,cross-browser,internet-explorer-11,Javascript,Jquery,Cross Browser,Internet Explorer 11,我编写的JS函数如下所示: function createConversionMappingItemRow(mapType, listObj, className, convValue, convText, currValue, currText) { $('#' + listObj).find('tbody') .append($('<tr>').attr({ class: className }) // <---- THIS IS L
function createConversionMappingItemRow(mapType, listObj, className, convValue, convText, currValue, currText) {
$('#' + listObj).find('tbody')
.append($('<tr>').attr({ class: className }) // <---- THIS IS LINE 3409, 'c' in 'class:' is the 42nd char
.append($('<td>').attr({ width: '5%', align: 'center' })
.append($('<input>').attr({ type: 'checkbox', onclick: (className == 'header' ? 'checkAllCurrentMapping("' + mapType + '", true)' : 'enableSaveButtons()') })
)
)
.append($('<td>').attr({ width: '45%', align: 'center' })
.append($('<span>').attr({ value: convValue })
.text(convText)
)
)
.append($('<td>').attr({ width: '5%', align: 'center' })
.append($('<span>').attr({ class: 'convarrow' })
.text('\u21c6')
)
)
.append($('<td>').attr({ width: '45%', align: 'center' })
.append($('<span>').attr({ value: currValue })
.text(currText)
)
)
);
}
函数createConversionMapingItemRow(mapType、listObj、className、convValue、convText、currValue、currText){
$('#'+listObj).find('tbody'))
.append($('').attr({class:className})/class
是一个JavaScript关键字。请尝试将其置于引号中:“class”
在IE11中,我的本地更改工作正常,但生产中的同一代码在同一浏览器中不工作!您确定生产代码已更新吗?在这方面无法真正帮助您。我已测试了上述代码,该代码在同一浏览器中使用了类
,没有引号。此代码存在于本地和生产中。IE11仅针对生产给出错误。根据haps生产站点url已在浏览器中以不同的设置(例如,兼容模式)注册。您将访问不同的url,用于生产和本地。