How to set the value of a text field when loading a page?

I need to set the asp.net TextBoxs value when loading a page using jQuery.
Can someone give me an example?

+3
source share
3 answers

try it

<script type="text/javascript">
    $(document).ready(function() {
            $("#TextBox1").val("Hello World");
            });
</script>
+1
source

If this is an ASP.NET text editor, try this:

<script type="text/javascript">
    $(document).ready(function(){
        $('#<%= tb_ASPTextBox.ClientID %>').val("my value"); 
    });
</script>
+2
source

All Articles