Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make disabled/readonly functionality for radio buttons and checkboxes

I know we can't make readonly radio button and checkbox. I tried to disable radio button and checkbox but in IE it is not visible.

Is any alternative way to do the same like disabled / readonly using jQuery, CSS, JavaScript?

like image 234
Raje Avatar asked May 14 '12 12:05

Raje


1 Answers

You can use the following code to avoid clicks on elements you don't want user to change

$(':radio,:checkbox').click(function(){
    return false;
});

You can use proper selector to limit the clicks.

like image 162
LoneWOLFs Avatar answered Sep 28 '22 03:09

LoneWOLFs