Reputation: 957
I have the following code that creates a paper-button dynamically. It works well but I can't figure out how to set the class.
var button = document.createElement('paper-button');
button.raised = true;
Polymer.dom(button).textContent = 'dynamic';
Polymer.dom(button).innerHTML = "New Button Text";
$(".notificationCollection").append(button);
This does not work:
Polymer.dom(button).class = "notificationBarButton";
I couldn't find anything in the documentation. Thanks.
Upvotes: 0
Views: 50
Reputation: 2043
additionaly, you can use
Polymer.dom(button).className = "notificationBarButton";
or even
Polymer.dom(button).classList.add("notificationBarButton");
classList has more functions .remove
or .toggle
.
documentation to classList: https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
Upvotes: 2
Reputation: 957
I stumbled upon the answer.
button.setAttribute("class", "notificationBarButton");
Upvotes: 0