我想添加多個HTML中的HTML標籤的屬性使用.attr()
但我發現了以下錯誤在我的螢火控制檯:得到錯誤使用.attr添加多個屬性()
SyntaxError: missing : after property id
[Break On This Error]
aria-selected: true,
#PrizeBondSearch (line 149, col 22)
這裏是代碼我試過了:
$('ul.k-group').find('a[href="#' + url + '"]').addClass('k-state-selected k-state-focused').parent().attr({
aria - selected: true,
id: 'panelbar_pb_active'
});
我不知道爲什麼我得到這個錯誤或如何解決它。 如果還有其他更好的方法,我會很高興知道它。