Search This Blog

HTML: read only checkbox


  • Method 1:
    <input name="test" type="checkbox" disabled checked/>
    
    Cons: disabled checkbox doesn't send value via POST data
  • Method 2:
    <input name="test" type="checkbox" checked onclick="return false;"/>
    
    Cons: does not work for double-clicks in IE.
  • Method 3:
    <input name="test" type="checkbox" checked onclick="this.checked=!this.checked;"/>
    
    Cons: does not work for double-clicks in IE.
  • No comments:

    Post a Comment