How to make a simple generator button using javascript?

Please tell me how to make such a code generator of a button-the link when you select the radio buttons immediately changed the final code button in the text box?
March 19th 20 at 08:39
3 answers
March 19th 20 at 08:41
on button listener in JavaScript handlers
Thank you very much! And do not tell how to set the default value? - carlotta76 commented on March 19th 20 at 08:44
@carlotta76, in the script add to the browser clicked on the first button when it's ready
- alexander.Beier commented on March 19th 20 at 08:47
and how to make the button itself (image) also varied depending on the choice? That is, if you choose the color red, then change code and color buttons.
5c9ca0949e39a407581686.png - carlotta76 commented on March 19th 20 at 08:50
Your code is unfortunately not working in IE 11
could you tell me how to fix it? - carlotta76 commented on March 19th 20 at 08:53
@carlotta76if I have no idea about ie11 that he's not supported :)
well, all the other add type of colors and sizes using if-then-else, otherwise

can be just work in ie too

var txt = document.querySelector('textarea');
var inputs = document.querySelectorAll('input[name="color"]')

for (var i = 0; i < inputs.length; i++) {
 inputs[i].addEventListener('click', function (e) {
 var target =;
 txt.value = '<button style="color:' + target.dataset.color + '>use this button</button>';
- alexander.Beier commented on March 19th 20 at 08:56
March 19th 20 at 08:43
On HTML dalecarlica.
Js written all ready features.
When you select the checkbox, the js inserts the prepared specifications.
Here are mostly js, it tracks the click and set the desired code.
March 19th 20 at 08:45
Used Ajax, this is a case when you need to dynamically substitute the right data.

Find more questions by tags JavaScript