hasClass()在IE中不起作用

hasClass() does not work in IE?

本文关键字:不起作用 IE hasClass      更新时间:2023-09-26

我得到Microsoft JScript runtime error: Object doesn't support this property or method当我使用IE8时。

if (this.hasClass('imgchargelocation')) {
                CallPopUp($(this).closest('tr')[0].sectionRowIndex, 'chargelocation');
            }

我也试过这个,但同样的错误…

if (this.attr('class', 'imgchargelocation')) {
                    CallPopUp($(this).closest('tr')[0].sectionRowIndex, 'chargelocation');
                }

hasClass似乎在chrome中工作得很好

似乎你正在使用jQuery,如果是,那么请修复你的语法像这样

if ($(this).hasClass('imgchargelocation')) {
  CallPopUp($(this).closest('tr')[0].sectionRowIndex, 'chargelocation');
}