GetTextbox Value in Javascript For Beginners?

Posted by Sabarimahesh under JavaScript category on | Points: 40 | Views : 994

<script type="text/javascript">
function TXT_Value() {
var value = document.getElementById('<%=TextBox1.ClientID%>').value;
return false;

Source Code

<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return TXT_Value();" />

Comments or Responses

Posted by: Self-Innovator on: 4/13/2012 Level:Bronze | Status: [Member] | Points: 10
The below statement is of type javascript not jQuery
var value = document.getElementById('<%=TextBox1.ClientID%>').value;

jQuery for the same Statement
var value=$("#<%=TextBox1.ClientID%>").val();

Posted by: Sabarimahesh on: 4/13/2012 Level:Bronze | Status: [Member] | Points: 10

Sorry Man ...

Before Posting this Code...

i posted to Jquery Code ...

So i wrongly Selected the Category

again Sorry ..

I Chenged

Login to post response