Is it possible to change the value of an <input type="text">
that has been hidden with a style of display:none
? I have some JS that seems to work when the input is <input type="hidden">
but not when it's hidden with display:none
. And AFAIK, you can't change an input's type with JS either.
Basically, I want to replace an <input>
with a <select>
, so I'm trying to hide it and append the <select>
element.
Take a look at http://jsfiddle.net/5ZHbn/
Inspect the <select>
element with firebug. Look at the hidden input beside it. Change the select's value. The hidden input doesn't change. Is Firebug lying to me?
If you uncomment the other lines of code, then it works.
Actually... I'm pretty sure it is a bug in Firebug now. Most other things correctly update, but firebug doesn't show the updated value when I inspect it.