how to set form attribute on a createElement input with Javascript
createelement, html, javascript
Solution
I've used
container.setAttribute("Form",'extra');
and it appears to be working in FF, Chrome and Opera.
Problem
can someone please help me out? I'm trying to create an input dynamically with this function, but the "form" attribute is not being set. ``` function addInput(parentID,inputNAME) { var padre = document.getElementById(parentID); var container = document.createElement("input"); container.type = "text"; container.name = inputNAME; container.value = ""; container.form = 'extra'; var enter = document.createElement("br"); padre.appendChild(container); padre.appendChild(enter); } ``` I've also tried with this: ``` container.formName = 'extra'; container['form'] = 'extra'; container.attributes['form'] = 'extra'; container.createAttribute('form','extra') ``` EDIT: Answer: `container.setAttribute("Form",'extra');`