4
我的代碼如下(也可在jsfiddle):jslint爲什麼會喊我?
$button = $('<button />', {
text: 'my button',
class: 'button'
});
的JSLint的錯誤信息是:
Problem at line 3 character 5: Expected an identifier and instead saw 'class' (a reserved word).
class: 'button'
我認爲這是抱怨,類是一個保留關鍵字,所以要使用它,你可能需要引號來區分它與關鍵字。但不知道... –