Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:22:25+00:00 2026-06-11T08:22:25+00:00

I am setting a taxtbox value using jquery in document.ready(). On a button click,

  • 0

I am setting a taxtbox value using jquery in document.ready().
On a button click, I am trying to access its value as txtbox1.Value() but I am getting “” empty string. But if I use an alert msg I get its value alert($(‘txtbox1’).val())

Please let me know whats the problem.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:22:27+00:00Added an answer on June 11, 2026 at 8:22 am

    It looks to me that you may have confused two different ways to get the value of an element.

    HTML

    <input id="txtbox1"></input>
    <button id="button1">test</button>​
    

    JS

    ​$(​"#button1").click(function(){
        alert($("#txtbox1").val());
    
        //or
    
        alert(document.getElementById("txtbox1").value);
    
    });​
    

    The first option get the document reference using jQuery syntax $("#txtbox1") then uses the jQuery function .val() to get the value of the input.

    The second option instead uses standard javascript to get a element reference via document.getElementById("txtbox1") and grabs the value from that object with .value.

    EXAMPLE

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
In my jqgrid I'm setting some values for textboxes using setCell Method. But when
Possible Duplicate: get jquery to return font-size in points Using jQuery, I'm setting something
Scenario: I am using Properties.Settings to save the variable with a button click. When
Quick Cross Browser JS question, when setting the value of a textbox: document.getElementById(balanceText).innerText =
I am setting the value of a textbox via javascript client-side. When I refresh
Setting a Magento store for a winery. They well bottles of wine, but you
I am trying to learn MVP It is using web forms in ASP.NET. I
The page has already run its' initialise/load sequences etc but then catches an event.
i´m new developing on asp.net mvc, and even newer using jquery, so this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.