У меня есть это внутреннее приложение, которое я сделал. Он отлично работает в IE9 (и во всех других браузерах), но некоторые из внутренних пользователей все еще находятся на IE8.Получение атрибута Class работает в IE9, но не IE8
Линия причиной проблемы является:
var thisClass = $thisElement.attributes.class.value;
Я получаю сообщение об ошибке «SCRIPT1010: Ожидаемый идентификатор» и маркер непосредственно перед с в классе.
Вот код:
$(document).on('click', function(){
var $this = $(this);
var $thisElement = $this.context.activeElement;
if ($thisElement != null && $thisElement.attributes.type != null && $thisElement.attributes.type.value == "checkbox" ){
var thisClass = $thisElement.attributes.class.value;
var thisValue = $thisElement.value;
if (thisValue == "All"){
if($thisElement.checked){
$('input[class="'+thisClass+'"]').each(function(i){
var checkboxValue = $(this).val();
$("#"+thisClass+checkboxValue).prop('checked',true);
});
}else {
$('input[class="'+thisClass+'"]').each(function(i){
var checkboxValue = $(this).val();
$("#"+thisClass+checkboxValue).prop('checked',false);
});
}
}else // since the val is not = all we want to uncheck the all box if any of the bottom boxes is unchecked
if (!$thisElement.checked){
$("#"+thisClass+"All").prop('checked',false);
}
cnse.checkTheCheckboxes();
}else{
return;
};// end if it is a checkbox
});
класс - это ключевое слово –