I want to disable all controls in a page using jquery except controls contained in a particular div.
$('input,select,textarea,div:not("#viewNotice")').attr('disabled', 'disabled');
I have tried using above selector, but its not working good. Here I am disabling all input, select and textarea
controls leaving viewNotive div.
Note: In viewNotice div I have a JqGrid. I dont want to disable jqgrid.
You should consider using something like a modal layer instead. This would be much simpler in many ways. However, you can try the following:
$(':input').not('#viewNotice :input').attr('disabled', true);
The selector you used selected all divs that did not have an id of viewNotice
(amongst other elements). This piece of code selects all input elements (see jQuery's selector API for :input
) and excludes all inputs that are contained in #viewNotice
afterwards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With