JSFiddle - React, Tailwind, and code Playground
HTML
<div id="controlAddIn"></div>
JavaScript
init();
CreateOption("Select1", "fuu");
CreateOption("Select1", "fuu2");
CreateOption("Select2", "fuu");
CreateOption("Select2", "fuu");
function init() {
createElement('h2', 'Määrät ja varastopaikat',
{id: 'heading', style: 'color:skyblue;font-family:arial;text-align:left;'},
null, 'controlAddIn');
createElement('input', null,
{id: 'qtybox', type: 'number', step: '0.01', class: 'inputbox', style: 'width:15%;display:inline-block;white-space:nowrap;'},
null, 'controlAddIn');
createElement('select', null,
{id: 'Select1', name: 'drop1', class: 'dropdwn', style: 'width:15%;', onchange: 'SelectedOne()'},
null,'controlAddIn');
createElement('select', null,
{id: 'Select2', name: 'drop2', class: 'dropdwn', style: 'width:30%;'},
null,'controlAddIn');
//[options[0], options[1], options[2], options[3]],
createElement('button', null,
{id: 'Button1', name: 'button1',
class: 'dropbtn', style: 'width:20%;', onclick: 'ButtonPress()'},
[document.createTextNode("Lisää")], 'controlAddIn');
RaiseAddInReady();
}
function createElement(){
var element = document.createElement(arguments[0]),
text = arguments[1],
attr = arguments[2],
append = arguments[3],
appendTo = arguments[4];
for(var key = 0; key < Object.keys(attr).length ; key++){
var name = Object.keys(attr)[key],
value = attr[name],
tempAttr = document.createAttribute(name);
tempAttr.value = value;
element.setAttributeNode(tempAttr)
}
if(append){
for(var _key = 0; _key < append.length; _key++) {
element.appendChild(append[_key]);
}
}
if(text) element.appendChild(document.createTextNode(text));
if(appendTo){
var target = appendTo === 'body' ? document.body : document.getElementById(appendTo);
target.appendChild(element)
}
return...