Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
99
rated 0 times [  102] [ 3]  / answers: 1 / hits: 23155  / 9 Years ago, tue, march 10, 2015, 12:00:00

I have not used this before just now and noticed it does not update its value in html?



Basically i have a Html Table with this in it , and user will update it to a quantity needed and Submit and i will take the Html parse it to get the things.



But in the html i see the value of input box is always 1, i it never updates itself



<input type=number id=testNumber   value=1 min=1 max=100 />

More From » input

 Answers
124

While yes, the markup indicates that the value is still 1, if this form were to be submitted, the displayed value of the number input would still get returned.



You can verify this by running the following in your browser's console:



var input = document.getElementById('testNumber');
input.value;


EDIT 1:



If you want the value of the html to match the value of the dom element, assign it yourself, like so:



input.setAttribute('value', input.value);

[#67508] Saturday, March 7, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarod

Total Points: 62
Total Questions: 111
Total Answers: 83

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
jarod questions
;