Tuesday 19 January 2016

JavaScript runtime error: Unable to get property 'TextBox1' of undefined or null reference

watch this example on YouTube:



to fix this error replace

    <script lang="javascript" type="text/javascript">
        function ValidateTextBox() {
            alert(document.Form1.TextBox1.value);
        }
    </script>
with:
    <script lang="javascript" type="text/javascript">
        function ValidateTextBox() {
            alert(document.getElementById('TextBox1').value);
        }
    </script>

No comments:

Post a Comment