Edit in JSFiddle

var form = document.getElementById("myform").elements;

for(var i = 0; i < form.length; i++){
	if(form[i].type == 'text'){
		console.log(form[i].name + ": " + form[i].value);
  }
}
<!-- Easy JavaScript - Iterate Through Form Fields #51 -->
<p>
Welcome to the 51st Easy JavaScript tutorial, part of <a href="http://www.easyprogramming.net">EasyProgramming.net</a>. Let's iterate through an HTML form, its fields, and its values. 
</p>
<p>
We know how to read individual form element items, but let's go a little deeper and actually iterate through an entire form without having to get each element individually. 
</p>
<form id="myform">
  <label for="name">Name</label>
  <input size="30" placeholder="Name" name="Name" id="name" type="text" value="Nazmus"> <br /><br />
    <label for="city">City</label>
    <input size="20" placeholder="Town or City" name="city" id="city" type="text" value="Boston"><br /><br />
    <label for="state">State</label>
    <input size="10" placeholder="State/Province" name="state" id="state" type="text" value="MA"><br /><br />
    <label for="zip">Postal Code</label>
    <input placeholder="Postal Code" name="zip" id="zip " type="text" value="02134"><br /><br />
    <label for="phone">Phone</label>
    <input size="16" placeholder="Phone Number" id="phone" name="phone" pattern="" type="text" value="(617)555-4024"><br /><br />
    <button type="submit" id="submitBtn" name="submit">Register Me!</button>
</form>