Commit a522d9d7 by Luciano Barletta

removes

1 parent c28f683f
...@@ -2,22 +2,26 @@ ...@@ -2,22 +2,26 @@
* Armado de formulario * Armado de formulario
*/ */
function removeField(b){ function removeField(b){
let div = b.parentElement; while(b.getAttribute("name") == "Field") b = b.parentElement;
let tab = div.parentElement; if(b.nodeElement == "body") return;
tab.removeChild(div); b.parentElement.removeChild(b);
} }
function addField(b){ function addField(b){
let newfield = document.createElement("div"); let newfield = document.createElement("div");
newfield.setAttribute("name","Field"); newfield.setAttribute("name","Field");
newfield.innerHTML = document.getElementById("fieldTemplate").innerHTML; newfield.innerHTML = document.getElementById("fieldTemplate").innerHTML;
b.parentElement.appendChild(newfield); let tab = b.parentElement;
// swap
tab.removeChild(b);
tab.appendChild(newfield);
tab.appendChild(b);
} }
function removeTab(b){ function removeTab(b){
let div = b.parentElement; while(b.getAttribute("name") == "Tab") b = b.parentElement;
let tab = div.parentElement; if(b.nodeElement == "body") return;
tab.removeChild(div); b.parentElement.removeChild(b);
} }
function addTab(t){ function addTab(t){
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!