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 9323205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:17:13+00:00 2026-06-19T04:17:13+00:00

How does value attribute work for the html input tag after an edit via

  • 0

How does value attribute work for the html input tag after an edit via the inputbox?

example:

<input type="text" name="test" id="test" value="Hello world" />

this will show an input box with the text “Hello world”. If I edit it inputing a new string into the rendered textbox (not via raw code), and then try to get his value using js like this

alert(document.getElementById('test').value)

I’ll, correctly, get the NEW value.
But if I inspect the element through chrome developer tools (or firebug or anything you prefer), I’ll see the same “Hello world” string as it was in the beginning..

Which of the two is the right one? js value or chrome inspector?

Here’s the Example Fiddle and here’s a screenshotenter image description here

I came up to this while trying to find a solution to this problem: Classic shop situation, I have a table with X inputs tag , where an user can input the quantity of X items. I need to check if one or more values have changed since the previous value of each input: if the comparison between OLD and NEW val returns that the valuehas changed, I need to update the order. Otherwise there’s no need to save/update.

I thought I could use attr. “value” to store the “old” value of the input, but probably was not the best choice..

Can anyone explain this behaviour? It’s only a “refresh” problem or is there something else behind?

  • 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-19T04:17:15+00:00Added an answer on June 19, 2026 at 4:17 am

    Both are right, they just show different things.

    The DOM value property gives you the current value.

    The HTML value attribute gives you the default value (the same as the DOM defaultValue property).

    The Chrome DOM inspector shows you attribute values in the HTML view. You have to look at the property view to see the property values.

    Screen shot of Chrome property view

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

Sidebar

Related Questions

Does anyone know how to convert the string value type -4,5 or 5,4 into
Does anyone know how I can get the value of an input box, without
I need set default selected value with text, here is my code: HTML: <select
What value does the hashCode() method return in java? I read that it is
What is a scalable algorithm to print an N-binary-digit integer manually whose value does
Does setting this value have the same effect as setting the debug=true in the
Does the timezone value change throughout the year to adjust to DST? So if
I have the code below. I'm wondering that does the self.value and _value have
Does anyone know exactly how this value is derived? For half our team it
I am currently loading HTMl content via AJAX. I have code for things on

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.