How can I get the form value from a disabled <input> element

后端 未结 10 1431
小鲜肉
小鲜肉 2020-12-04 23:50

The HTML standard for forms appears to be such that disabled input elements do not contribute to the form name/value collection.

Is there ANY way to get around this?

10条回答
  •  自闭症患者
    2020-12-05 00:17

    Its Simple only two steps

    1. check if the input you want to access is disabled if it is then remove its "disabled" attribute

    2. Get the value and then add the disabled attribute again.

提交回复
热议问题