Can HTML checkboxes be set to readonly?

前端 未结 30 2138
無奈伤痛
無奈伤痛 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 09:08

    I happened to notice the solution given below. In found it my research for the same issue. I don't who had posted it but it wasn't made by me. It uses jQuery:

    $(document).ready(function() {
        $(":checkbox").bind("click", false);
    });
    

    This would make the checkboxes read only which would be helpful for showing readonly data to the client.

提交回复
热议问题