Hello i want to create dynamic drop-downs using javascript, but its not working..
My PHP code:
<input type="button" onclick="javascript:addRow();" value="Add Row" name="addRow"/>
My JS code:
// This function is used to create dynamic form element
function addRow() {
var opt = document.createElement("option");
element = document.createElement("select");
element.setAttribute('id', 'focus');
element.options.add(opt);
}
PS: It is not giving any js console error.
you dont add the element to the body so it doesn’t show up