Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disabling radio buttons by name attribute with jquery

say I have a bunch of radio buttons in an html form. How do I find and disable all radio input types with a given name="?" value (where ? can be anything I specify)?

like image 497
aeq Avatar asked Dec 22 '22 23:12

aeq


1 Answers

It is simple:

$('input[name="name_here"]').attr('disabled', 'disabled');

Replace name_here with the name of your radio buttons.

And you can enable it back from code using:

$('input[name="name_here"]').removeAttr('disabled'');
like image 139
Sarfraz Avatar answered Feb 12 '23 02:02

Sarfraz