Use css to disable the input control to achieve the disable effect

Article directory

need

Use css to disable the input control to achieve the disable effect

analyze

In js, we use the following methods to prevent the default events of input, select, checkbox, such as

javascript event.preventDefault() 
event.stopPropagation()

But in css, we can set the effect that the input box cannot be clicked and add the transparency of the input box to achieve the disabled effect

the code

insert image description here

<input style="pointer-events: none;background-color: rgba(233, 233, 233, 0.5);" />

Guess you like

Origin blog.csdn.net/qq_53810245/article/details/131403598