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 screenshot
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?
