Skip to content

Instantly share code, notes, and snippets.

@parkerproject
Created September 20, 2016 01:49
Show Gist options
  • Select an option

  • Save parkerproject/fb8ac923c1a811d5ff59e1bd216f8a8d to your computer and use it in GitHub Desktop.

Select an option

Save parkerproject/fb8ac923c1a811d5ff59e1bd216f8a8d to your computer and use it in GitHub Desktop.
var form,
docfrag,
formId,
inputString1,
inputString2,
inputNameString1,
inputNameString2;
docfrag = document.createDocumentFragment();
form = document.createElement("form");
formId = document.createAttribute("id");
formId.value = 'str-form';
form.setAttributeNode(formId);
inputString1 = document.createElement("input");
inputNameString1 = document.createAttribute("name");
inputNameString1.value = 'str1';
inputString1.setAttributeNode(inputNameString1);
inputString2 = document.createElement("input");
inputNameString2 = document.createAttribute("name");
inputNameString2.value = 'str2';
inputString2.setAttributeNode(inputNameString2);
form.appendChild(inputString1);
form.appendChild(inputString2);
docfrag.appendChild(form);
document.getElementsByTagName('body')[0].appendChild(docfrag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment