Hello,
You can use below function for create dynamic input type using Javascript function.
$(document).ready(function () {
add("button");
});
function add(type) {
var element = document.createElement("input");
element.type = type;
element.value = type;
element.name = type;
element.onclick = function() {
alert("Demo");
};
var foo = document.getElementById("SpanName");
foo.appendChild(element);
}
document.getElementById("btnAdd").onclick = function() {
add("text");
};
<input type="button" id="btnAdd" value="Add Text Field">
<p id="fooBar">Fields:</p>
If you have any query regarding this solution, please ask me.