Created
September 26, 2017 17:30
-
-
Save mohsen1/55a1550c3bc0fc8819aea81dcf15d43b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create an input element | |
* @param {string} type | |
* @param {string|boolean} value | |
* @return {HTMLInputElement} | |
*/ | |
function createInput(type, value) { | |
const el = document.createElement('input'); | |
el.type = type; | |
if (type === 'checkbox') { | |
el.checked = value; | |
} else { | |
el.value = value; | |
} | |
return el; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment