Getting Textbox value in Javascript
<p>I am trying to get the value of the textbox in a javascript, but its not working. Given below is the code of my test page</p>

<pre><code>&lt;%@ Page Title="" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeFile="test3.aspx.vb" Inherits="test3" %&gt;

&lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server"&gt;
&lt;script language="javascript"&gt;

    function GetAlert() {

        var TestVar = document.getElementById('txt_model_code').value;
        alert(TestVar);

    }

&lt;/script&gt;
&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server"&gt;
&lt;asp:TextBox ID="txt_model_code" runat="server" &gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&lt;br /&gt;

&lt;input type="button" value="db Function" onclick="GetAlert()" /&gt;&lt;br /&gt;
&lt;/asp:Content&gt;
</code></pre>

<p>So where am i going wrong?? How to get the text entered in the textbox in the javascript???</p>
