I have read a bit on this, but I can't seem to find anything solid about how different browsers treat things.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
Elements with Disabled attribute would not submitted or can say their values would not posted with request.
i.e.
Difference
Use readonly attribute in case you want to post your field's data.
i.e.
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".
No events get triggered when the element is having disabled attribute.
None of the below will get triggered.
While readonly will be triggered.
Same as the other answers (disabled isn't sent to the server, readonly is) but some browsers prevent highlighting of a disabled form, while read-only can still be highlighted (and copied).
http://www.w3schools.com/tags/att_input_disabled.asp
http://www.w3schools.com/tags/att_input_readonly.asp
A
readonly
element is just not editable, but gets sent when the accordingform
submits. adisabled
element isn't editable and isn't sent on submit. Another difference is thatreadonly
elements can be focused (and getting focused when "tabbing" through a form) whiledisabled
elements can't.Read more about this in
this great articleor the definition by w3c. To quote the important part: