Can HTML checkboxes be set to readonly?

前端 未结 30 2244
無奈伤痛
無奈伤痛 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:04

    I just don't want the client to be able to change them under certain circumstances.

    READONLY itself won't work. You may be able to do something funky w/CSS but we usually just make them disabled.

    WARNING: If they're posted back then the client can change them, period. You can't rely on readonly to prevent a user from changing something. The could always use fiddler or just chane the html w/firebug or some such thing.

提交回复
热议问题