2017-05-01 29 views
0

我有以下代碼可以動態創建紙張按鈕。它運作良好,但我無法弄清楚如何設置課程。設置動態創建的紙張按鈕的類別不起作用

var button = document.createElement('paper-button'); 
button.raised = true; 
Polymer.dom(button).textContent = 'dynamic'; 
Polymer.dom(button).innerHTML = "New Button Text";  
$(".notificationCollection").append(button); 

這不起作用:

Polymer.dom(button).class = "notificationBarButton"; 

我找不到文檔中的任何東西。謝謝。

回答

0

我偶然發現了答案。

button.setAttribute("class", "notificationBarButton");