Reputation: 728
Trying to add the submit button dynamically through javascript, below is the code snippet, not sure which attribute to use for setting the text.
var dynSubmit = document.createElement("paper-button");
dynSubmit.setAttribute("on-click", "submitForm");
//dynSubmit.setAttribute("Value", "Submit");
parent.$.iron-form.appendChild(dynSubmit);
The commented code does not work, How do i set the caption of submit button?
Upvotes: 4
Views: 1484
Reputation: 155662
Avoid using innerHTML
with Polymer, or at all really; it's slow, it's where XSS can get in, and you shouldn't need it.
Instead use textContent
:
dynSubmit.textContent = 'Submit';
You can set this without breaking the ripple and you shouldn't need the Polymer.dom(dynSubmit)
as it's an exposed property on the underlying element.
Upvotes: 0
Reputation: 662
You can set the button's innerHTML
.
Polymer.dom(dynSubmit).innerHTML = "Submit";
Thanks to @jonsS0 for his handy comment.
Upvotes: 4