Can HTML checkboxes be set to readonly?

前端 未结 30 2259
無奈伤痛
無奈伤痛 2020-11-22 08:39

I thought they could be, but as I\'m not putting my money where my mouth was (so to speak) setting the readonly attribute doesn\'t actually seem to do anything.

I\'d

30条回答
  •  忘掉有多难
    2020-11-22 08:51

    
    

    with jquery:

    $(':checkbox[readonly]').click(function(){
                return false;
            });
    

    it still might be a good idea to give some visual hint (css, text,...), that the control won't accept inputs.

提交回复
热议问题