Create Input Fields by Click in JS


<form method="POST">
  <div id="InputFields">Entry 1
  <input name="myInputs" type="text"></div>
  <input type="button" value="Add Input" >
</form>


var counter = 1;
var limit = 5;
function addInputFileds(divName){
if (counter == limit)  {
    alert("You have reached the limit of adding " + counter + " inputs");
}
else {
 var newdiv = document.createElement('div');
 newdiv.innerHTML = "Entry " + (counter + 1) + " <br><input type='text' name='myInputs'>";
 document.getElementById(divName).appendChild(newdiv);
 counter++;
}
}