Skip to content Skip to sidebar Skip to footer

Input Field Value Attribute Wont Change Unless Type="hidden"

I wanted to maintain a input field to keep a variable which does not need to display at the front-end. So I created an input filed like below. html

Solution 1:

In general, the value attribute describes the default value, not the current value (which you can access through the value property (which is what val() does)).

Hidden inputs aren't user editable, so you may find that the default and current values are the same for them.


Solution 2:

If you are changing the value using .val(), wont be able to see the changes in google inspect because .val() return the current value first before it finishing operation.

If you are changing value using .attr(value) you can able to see the changes in google inspect


Post a Comment for "Input Field Value Attribute Wont Change Unless Type="hidden""