Values of disabled inputs will not be submitted

前端 未结 7 2356

This is what I found by Firebug in Firefox.

Is it the same in other browsers?

If so, what\'s the reason for this?

7条回答
  •  暖寄归人
    2020-11-22 06:07

    You can use three things to mimic disabled:

    1. HTML: readonly attribute (so that the value present in input can be used on form submission. Also the user can't change the input value)

    2. CSS: 'pointer-events':'none' (blocking the user from clicking the input)

    3. HTML: tabindex="-1" (blocking the user to navigate to the input from the keyboard)

提交回复
热议问题