Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 07, 2012 02:26 PM by himanshu28
Member
84 Points
51 Posts
Apr 19, 2012 11:05 AM|LINK
var result = $get("txtInput").value; alert(result);
is not working in my page . What might be the reason??????
182 Points
Apr 19, 2012 11:08 AM|LINK
use below code:
var result = document.getElementById('<%=txtInput.ClientID %>').value;
alert(result);
Contributor
3217 Points
1179 Posts
Apr 19, 2012 11:09 AM|LINK
try this
var result = $("#txtInput").value; alert(result);
Apr 19, 2012 11:12 AM|LINK
It's not working
Below is my code
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <script src="jquery-1.7.1.min.js" type="text/javascript"></script> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <center> <label> Enter a value:</label><input type="text" id="txtInput" /> <br /> <input type="button" id="btnSubmit" value="Show" /> </center> <script type="text/javascript" language="javascript"> $('input[id$=btnSubmit]').click(function () { var result = $get("txtInput").value; alert(result); }); </script> </asp:Content>
Apr 19, 2012 11:24 AM|LINK
try this code
<center> <label> Enter a value:</label><input type="text" id="txtInput" /> <br /> <input type="button" id="btnSubmit" value="Show" /> </center> <script type="text/javascript"> $(document).ready(function () { $('#btnSubmit').live('click', function () { var result = $("#txtInput").val(); alert(result); }); }); </script>
Apr 19, 2012 12:14 PM|LINK
I need to use $get in my functionality.
Star
8079 Points
1491 Posts
Apr 19, 2012 12:24 PM|LINK
var result = $('txtInput').val();
why do you "need" to use "$get" ????
$get(elementId) returns DOM element, same as document.getElementById(elementId);
$result = $get('txtInput'); var x = $result.val();
it's the same thing, you're just doing more work
270 Points
80 Posts
Apr 19, 2012 02:23 PM|LINK
Just add scriptmanager to page and and run it...
because u can use $ symbol in ajax and jquery
otherwise use
Document.GetElementById("txtInput").value
My .Net Blog is http://chikkanti.wordpress.com/
All-Star
65789 Points
11153 Posts
Apr 20, 2012 03:49 AM|LINK
http://api.jquery.com/jQuery.get/
http://blogs.msdn.com/b/irenak/archive/2007/02/19/sysk-290-asp-net-ajax-get-vs-find.aspx
3 Points
18 Posts
May 07, 2012 02:26 PM|LINK
//try this, this is working var result = document.getElementById("<%=txtInput.ClientID%>").value; //below is not working but in one of my previous project it was work, I swear var a = document.getElementById("<%=txtInput.ClientID%>").innerHTML;
MaheshKumarC...
Member
84 Points
51 Posts
var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 11:05 AM|LINK
var result = $get("txtInput").value; alert(result);is not working in my page . What might be the reason??????
www.jkc-forum.in
Mark this post as answer if this helps.It can save others time.
thomas.watso...
Member
182 Points
51 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 11:08 AM|LINK
use below code:
var result = document.getElementById('<%=txtInput.ClientID %>').value;madan535
Contributor
3217 Points
1179 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 11:09 AM|LINK
try this
var result = $("#txtInput").value; alert(result);MaheshKumarC...
Member
84 Points
51 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 11:12 AM|LINK
It's not working
Below is my code
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <script src="jquery-1.7.1.min.js" type="text/javascript"></script> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <center> <label> Enter a value:</label><input type="text" id="txtInput" /> <br /> <input type="button" id="btnSubmit" value="Show" /> </center> <script type="text/javascript" language="javascript"> $('input[id$=btnSubmit]').click(function () { var result = $get("txtInput").value; alert(result); }); </script> </asp:Content>www.jkc-forum.in
Mark this post as answer if this helps.It can save others time.
madan535
Contributor
3217 Points
1179 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 11:24 AM|LINK
try this code
<center> <label> Enter a value:</label><input type="text" id="txtInput" /> <br /> <input type="button" id="btnSubmit" value="Show" /> </center> <script type="text/javascript"> $(document).ready(function () { $('#btnSubmit').live('click', function () { var result = $("#txtInput").val(); alert(result); }); }); </script>MaheshKumarC...
Member
84 Points
51 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 12:14 PM|LINK
I need to use $get in my functionality.
www.jkc-forum.in
Mark this post as answer if this helps.It can save others time.
robwscott
Star
8079 Points
1491 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 12:24 PM|LINK
var result = $('txtInput').val();why do you "need" to use "$get" ????
$get(elementId) returns DOM element, same as document.getElementById(elementId);
$result = $get('txtInput'); var x = $result.val();it's the same thing, you're just doing more work
Mark Answered if it helps - Good luck!
Cheers!
Design And Align
- Rob
chikkanti
Member
270 Points
80 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 19, 2012 02:23 PM|LINK
Just add scriptmanager to page and and run it...
because u can use $ symbol in ajax and jquery
otherwise use
Document.GetElementById("txtInput").valueMy .Net Blog is http://chikkanti.wordpress.com/
chetan.sarod...
All-Star
65789 Points
11153 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
Apr 20, 2012 03:49 AM|LINK
http://api.jquery.com/jQuery.get/
http://blogs.msdn.com/b/irenak/archive/2007/02/19/sysk-290-asp-net-ajax-get-vs-find.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
himanshu28
Member
3 Points
18 Posts
Re: var result = $get("txtInput").value; alert(result); is not working in my page .
May 07, 2012 02:26 PM|LINK
//try this, this is working var result = document.getElementById("<%=txtInput.ClientID%>").value; //below is not working but in one of my previous project it was work, I swear var a = document.getElementById("<%=txtInput.ClientID%>").innerHTML;