Skip to content

Instantly share code, notes, and snippets.

@RobyCigar
Created September 18, 2021 11:39
Show Gist options
  • Save RobyCigar/ea5c06544af201a11bf1b76deef47b80 to your computer and use it in GitHub Desktop.
Save RobyCigar/ea5c06544af201a11bf1b76deef47b80 to your computer and use it in GitHub Desktop.
script create form
// document.body.innerHTML = " "
// document.body.style.background = 'white'
function createInput(container, label, type) {
var container = document.createElement('div')
var l = document.createElement('label')
var i = document.createElement('input')
l.innerHTML = `${label} : `;
i.setAttribute('type', type)
container.appendChild(l)
container.appendChild(i)
return container
}
var container = document.createElement('div');
var res = createInput(container, 'jumlah', 'number')
document.body.appendChild(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment