What's the difference between disabled=“disabled” and readonly=“readonly” for HTML form input fields?

后端 未结 5 1530
执笔经年
执笔经年 2020-11-22 04:17

I have read a bit on this, but I can\'t seem to find anything solid about how different browsers treat things.

5条回答
  •  感动是毒
    2020-11-22 05:06

    Disabled means that no data from that form element will be submitted when the form is submitted. Read-only means any data from within the element will be submitted, but it cannot be changed by the user.

    For example:

    
    

    This will submit the value "Bob" for the element "yourname".

    
    

    This will submit nothing for the element "yourname".

提交回复
热议问题