Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.09k stars 4.95k forks source link

JS + DOM + dropdown #7003

Closed newmvf closed 4 years ago

newmvf commented 4 years ago

Javascript function to create "Dropdown selection" = don't work, any1 knows how to fix? Semantic-ui v,2.4.1

` function gerarDDInput() {

var divClass = document.createElement('div');
divClass.setAttribute('class', 'ui dropdown selection');
var divInput = document.createElement('input');
divInput.value = 'af';

var icon = document.createElement('i');
icon.setAttribute('class', 'dropdown icon');

var atrDIV = document.createElement('div');
atrDIV.setAttribute('class', 'default text');
atrDIV.innerHTML += 'atributo';

var menuDIV = document.createElement('div');
menuDIV.setAttribute('class', 'menu');

var menuItem1 = document.createElement('div');
menuItem1.setAttribute('class', 'item');
menuItem1.setAttribute('data-value', 'af');
menuItem1.innerHTML += '<i class="user icon"></i>affff';

menuDIV.appendChild(menuItem1);

divInput.appendChild(icon);
divInput.appendChild(atrDIV);
divInput.appendChild(menuDIV);

divClass.appendChild(divInput);

var dX = document.createElement('div');
dX.setAttribute('class', 'ui form segment');

dX.appendChild(divClass);

document.getElementById('atrHolderTD').appendChild(dX);

} `