Validating DOM Elements
<p>I have some input HTML elements which I want to validate whether they are filled up or not. Basically, they are mandatory. I am doing something like this:</p>

<pre><code>    var displayNames new Array();
    displayNames[0] = "Name";
    displayNames[1] = "Address";
    displayNames[2] = "Age";

function validForm() {
    var Name = document.getElementById(txtName).value;
    if(!Name) {
      alert(displayName[0] is required);
    }}
</code></pre>

<p>How should I make the validations easy in JS?</p>
