I use this java script function to display a form validation hint. This function is working properly with input elements.. My problem is I need to modify this function with other form elements such as textarea, select box, checkbox... can anybody tell me how can I do this?

This is the function I have been using..

```
function prepareInputsForHints() {
    var inputs = document.getElementsByTagName("input");
    for (var i=0; i<inputs.length; i++){
        // test to see if the hint span exists first
        if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
            // the span exists!  on focus, show the hint
            inputs[i].onfocus = function () {
                this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
            }
            // when the cursor moves away from the field, hide the hint
            inputs[i].onblur = function () {
                this.parentNode.getElementsByTagName("span")[0].style.display = "none";
            }
        }
    }
    // repeat the same tests as above for selects
    var selects = document.getElementsByTagName("select");
    for (var k=0; k<selects.length; k++){
        if (selects[k].parentNode.getElementsByTagName("span")[0]) {
            selects[k].onfocus = function () {
                this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
            }
            selects[k].onblur = function () {
                this.parentNode.getElementsByTagName("span")[0].style.display = "none";
            }
        }
    }
}

```

this is Html 

```
<div>
    <label for="mobile">Mobile<img alt="required" src="images/required_star.png"> :</label>
    <input id="mobile" class="text" type="text" maxlength="10" name="mobile" title="Eg: 0714556260"/>
    <span class="hint">Use a 10 digits length number<span class="hint-pointer">&nbsp;</span></span>
</div>

```

I tried something like this with textarea but it is not working...

```
<div>
    <label for="qualification">Qualification Details<img alt="required" src="images/required_star.png">:</label>
    <textarea id="qualification" class="textarea" rows="4" cols="30" name="qualification"></textarea>
        <span class="hint">Describe about you<span class="hint-pointer">&nbsp;</span></span>

</div>

```