Hi!
I would like to create a a group of radio buttons dynamically in JS. But
for some reason it doesn't work. When I put the radio buttons in manually
it works but when I add them through JS then I can select multiple radio
buttons at the same time. Maybe I am not updating the DOM properly. What
could be the problem? What is the proper way of creating radio-buttons
inside radio-group through JS?
Thank you.
var apRadioGroup = document.querySelector('#apRadioGroup');
// removing all previous children
while (apRadioGroup.firstChild) {
apRadioGroup.removeChild(apRadioGroup.firstChild);
}
results.forEach(function(res) {
// create and add a new element
var rb = document.createElement('paper-radio-button');
Polymer.dom(rb).setAttribute('name',res.ssid);
Polymer.dom(rb).innerHTML += res.ssid;
Polymer.dom(rb).innerHTML += ' [' + res.dBm + 'dBm]';
Polymer.dom(apRadioGroup.root).appendChild(rb);
});
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/150d1aee-c681-44f3-bcb5-d9d2669c297f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.