w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Displaying Hidden Information using external JS

You spelled function incorrectly in your script.

Also in your html remove the ; in the onclick attribute. seems to have cleaned up the errors for me.

 function validateForm() {
        var name = document.getElementById('txtName').value;
        var nameLength = name.length;
        if (nameLength < 6) {
            document.getElementById("txtNameError").style.visibility =
"visible";
        }
    }

and

<td><button onclick="validateForm();">Register</button></td>

should be <td><button onclick="validateForm()">Register</button></td>

Additionally I re-wrote the setup using jQuery for easier checks on the html elements however if you require them to be in javascript I can look into re writing it again, check out my updated jsfiddle here: http://jsfiddle.net/dhershman/365r5tg5/1/





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.