How do I make a checkbox unclickable *without* it being greyed out in the browser?

B Seven picture B Seven · Jun 20, 2011 · Viewed 26.2k times · Source

How do you create an HTML checkbox that is unclickable, but not greyed out? I used the disabled=disabled tag, but that makes it greyed out (in Chrome). Otherwise it works well. Working in jQuery and Rails...

Thanks.

Answer

Andrew Whitaker picture Andrew Whitaker · Jun 20, 2011

Usability concerns aside:

$("input:checkbox").click(function() { return false; });

For example: http://jsfiddle.net/nKwRj/