ASP.Net Javascript integration

Posted by tcables on Stack Overflow See other posts from Stack Overflow or by tcables
Published on 2010-04-06T14:27:58Z Indexed on 2010/04/06 14:33 UTC
Read the original article Hit count: 298

Filed under:
|

I am trying to use the following script in asp.net:

<script language="javascript" type="text/javascript">
    function checktext() {
        var txt = document.getElementById('tbComments');

        if (txt.Text.Length > 0) {
            alert('Thank you for submitting feedback.');

            return true;
        }
        else {
            alert('Sorry, you must enter text before submitting.')

            return false;
        }
    }
</script>


    <asp:Button ID="btnSave" runat="server" Text="Submit" onclick="btnSave_Click" OnClientClick="checktext();" />

I have tried using it on the onclick event.. the script will just not work at all.

Any Ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET