I'm struggling with incorporating this button creation code into my HTML using JavaScript. The code for creating the button element in JS file looks like this:
var numery = ['A','B','C'];
var numer = document.createElement("button");
numer.type = "button";
numer.value =numery[i];
numer.className = "class1 class2";
numer.innerHTML = numery[i];
The structure of the HTML where I want to append these buttons is as follows:
<div class="container_b pull-left" id="container_b">
<button type="button" class="btn_budynki" id="naglowek_budynkow_zwiniety">Header button</button>
<div class="btn-group-vertical pull-left hide" role="group" id="grupa_bud">
<button type="button" class="btn_budynki_top btn_budynki" id="naglowek_budynkow">Another header</button>
<button type="button" class="btn_strzalka btn_strzalka_gora border_top" id="strzalka_gora_bud"><span class="glyphicon glyphicon-chevron-up"></span>
</button>
<!-- i want to put created elements as buttons here-->
<button type="button" class="btn_strzalka btn_strzalka_dol border_top">
<span class="glyphicon glyphicon-chevron-down"></span>
</button>
</div>
</div>
When trying to use appendChild and specifying the id of the element above (strzalka_gora_bud), it appends the new elements before the end tag of that particular element. Can someone please assist me in resolving this issue?