Home >Web Front-end >JS Tutorial >Two ways to set checkbox to readOnly_javascript skills

Two ways to set checkbox to readOnly_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:20:111801browse
Method 1:

The checkbox does not have a readOnly attribute. If you use the disabled="disabled" attribute, the checkbox will turn gray. Users are disgusted with this style. You can keep it only like this Read:
Set its onclick="return false"

In js it is checkbox.onclick=function(){return false;};

Method 2:
Copy code The code is as follows:



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn