我試圖創建一系列從播放列表中的視頻標題獲取標籤的按鈕。每次我運行我的代碼時,我會從「var singleButton ....」開始的行中得到一個「Uncaught SyntaxError:Unexpected token class」錯誤。我懷疑它與我試圖生成一個div類但我不確定。我不斷收到未捕獲的SyntaxError:意外的令牌類
任何人都可以看到我做錯了什麼?任何見解都非常感謝。
<script type="text/javascript">
var items = jwplayer().getPlaylist(),
allButtons = ''; //empty str
jwplayer().on('adError', function(evt) { console.log(evt); });
for(var i = 0; i < items.length; i++) {
var singleButton = ""<div class="buttons01"><button type="button">"" + items[i].title + ""</button></div>"";
allButtons += singleButton;
console.log(singleButton);
console.log(allButtons);
}
</script>
謝謝。
'VAR singleButton = 「」
「」;'不看錯嗎?即使語法突出顯示也有問題。您是否在使用IDE進行開發?或者只是一個文本編輯器? –我只是使用崇高。你會推薦一個IDE嗎? –