Run code If I change the t...">

Where is my current input value stored?

Consider this code:

<input type="text" id="my-input" value="foo">
Run code

If I change the text inside the input field, I know that I can get it through:

  • $('#my-input').val()
  • document.getElementById('my-input').value

But if I Right click> Inspect, I will see something like:

enter image description here

Is there a way to see the value foobarinside the DOM? If not, where is this value stored?

This question is a browser agnostic, the background, which may be here, is a strange mistake inIE 11.0.14

+4
source share
3 answers

Is there any way to see it inside the DOM?

DOM (, -, , , Chrome, DOM, . Andrey answer). , , DOM , . , , , , .

, ?

. - , , DOM . HTMLInputElement value , . HTML; value input, . ( defaultValue property.) , , id, id, value ( ).

+3

Chrome. DOM, Show user agent shadow DOM a > .

, #inner-editor .

Firefox

:

  • DOM
  • Shadow DOM properties
  • .

: , Chrome, javascript.

+5

( HTML) , HTML. , HTML. .

(, Chrome) "", . value , .

In the Firefox debugging tools, you can right-click an item in the DOM viewer and select Use in Console. This will reset the temp variable to the console, which you can use to access the properties of the element (including it .value).

+1
source

Source: https://habr.com/ru/post/1673023/


All Articles