You must Sign In to post a response.
  • Category: ASP.NET

    Please anybody help me to get textbox value using jquery

    How to get the value of a asp.net textbox control using jquery?
  • #763293
    Hi,

    Use below sample



    var val=$("#txtVal").Val();

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #763304
    You can use '#' selector to get textbox in JQuery
    see below snippet
    //to get value
    $("#txtEmpName").val()
    //to set value
    $("#txtEmpName").val("abc")

    for more JQuery question I have already written an article on it can check beow link
    http://www.dotnetspider.com/resources/46278-JQuery-Interview-Question.aspx

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #763315
    you are trying to access the ASP.net text box. So you have to provide the clientId or UniqueId

    $('#<%=txtEmpName.ClientID %>').val()

    By Nathan
    Direction is important than speed

  • #763323
    Hello Ranajoy,

    By using below code you can get the textbox value :

    var email = $("#txtEmail").val()

    By using below code you can set the textbox value :

    $("#txtEmail").val("sender@gmail.com")


    Hope you understand the logic. It is very simple.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


Sign In to post your comments