There are two ways to set the checkbox to readOnly

  • 2020-03-26 21:26:07
  • OfStack

A:

The checkbox doesn't have a readOnly property, and if you use the disabled= "disabled" property, it will turn the checkbox gray, and the user is annoyed that this style keeps it read-only:
Set its onclick="return false"

Checkbox.onclick =function(){return false; };

Method 2:
 
<script src="Demo3.1/jquery-1.4.2.min.js" type="text/javascript"></script> 
<script language="javascript"> 
$(function(){ 
$("input[type='checkbox']").click( 
function(){ 
this.checked = !this.checked; 
} 
); 
} 
); 
</script> 

Related articles: