Comparison of the use of form element attributes readonly and disabled

Comparison of the use of form element attributes readonly and disabled
1) Scope of application:
readonly:input[type="text"],input[type="password"],input[type="teaxtarea"]
disabled: all form elements, such as select, radio, checkbox, button, etc.

2) Operation:
readonly: users are not allowed to modify the operation, and no other operations are affected
disabled: Prevents all user operations, including user click events and focus events

3) Form submission:
readonly: The value of the form element can be submitted to the server.
disabled: The value of the form element will not be submitted to the server, that is, the server cannot obtain the value of this form element

Common applications:

a> In a form, a unique identification code is pre-filled for the user, and the user is not allowed to change it, but the value needs to be passed when submitting. In this case, its attribute should be set

is readonly;

b>Prevent duplicate submission of the form and use javascript to disable the submit button (form button) after submitting the form.

c>Set checkbox and radio to read-only: disable default events such as: bind("click",function(){return false;}) in jQuery;

<<:  4 ways to achieve a two-column layout with fixed left column and adaptive right column using CSS

>>:  Sample code for making desktop applications with vue + Electron

Recommend

Introduction to CSS style classification (basic knowledge)

Classification of CSS styles 1. Internal style --...

Comparison of several examples of insertion efficiency in Mysql

Preface Recently, due to work needs, I need to in...

Solution to forgetting mysql password under linux

The problem is as follows: I entered the command ...

Interpretation of the module for load balancing using nginx

Table of contents Two modules for using nginx for...

Detailed explanation of Vue's caching method example

Recently, a new requirement "front-end cache...

Vue realizes simple effect of running light

This article shares the specific code of Vue to a...

Detailed explanation of VUE Token's invalidation process

Table of contents Target Thought Analysis Code la...

Implementation methods of common CSS3 animations

1. What is CSS Animations is a proposed module fo...

Introduction to the role of HTML doctype

Document mode has the following two functions: 1. ...

Use simple jQuery + CSS to create a custom a tag title tooltip

Introduction Use simple jQuery+CSS to create a cus...

How to install pip package in Linux

1. Download the pip installation package accordin...

Quickly solve the problem that CentOS cannot access the Internet in VMware

Yesterday I installed CentOS7 under VMware. I wan...

Installation tutorial of MySQL 5.7.17 zip package version under win10

The installation tutorial of mysql5.7.17 is share...

js canvas to realize the Gobang game

This article shares the specific code of the canv...