Values of disabled inputs will not be submitted

前端 未结 7 2221

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 05:53

    Yes, all browsers should not submit the disabled inputs, as they are read-only.

    More information (section 17.12.1)

    Attribute definitions

    disabled [CI] When set for a form control, this Boolean attribute disables the control for user input. When set, the disabled attribute has the following effects on an element:

    • Disabled controls do not receive focus.
    • Disabled controls are skipped in tabbing navigation.
    • Disabled controls cannot be successful.

    The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

    This attribute is inherited but local declarations override the inherited value.

    How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc.

    In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

    
    

    Note. The only way to modify dynamically the value of the disabled attribute is through a script.

提交回复
热议问题