Who can explain this to me? I have an input field with value=“2” and in the shown value in the screen is “undefined” and I can even edit this undefined if I select it.
the HTML is
<input class = "transportDaysValue editOutput" id = "editOrderTransportDays" type = "text" value = "2" readonly>
I have no idea what is can do to debug this further. For me it looks like there is another input field with value “undefined” over the shown input field but I cannot find any in the dom.
PS: I have just added a “display: none” to the input field and the undefined is gone. So the input field seems to contain the undefined even if the Dom says its value = “2”
Yes that’s really strange isn’t it? I have all tested in different browser but all the same
I do not use name attributes att all my html because I do not use forms. It has never been a problem as I do it that way for hundreds or more of inputs/textareas/selects etc.
I have just removed all classes and now I see a standard input field, containing “undefined” which I can edit. I am really confused
Is there anything on the page that might be interacting with the field after its put into the DOM? Validators, modifiers…? (I will for the moment handwave the idea of using a text field for a number…
So the browser doesnt update the value listed in the DOM, that way it can restore the value to its original if you reset the form by just reading the DOM again. (Remember when input type=“reset” was a thing? yea.)