Disable all controls on the page except the controls in a separate div using jquery

I want to disable all controls on a page using jquery, except for the controls contained in a specific div.

 $('input,select,textarea,div:not("#viewNotice")').attr('disabled', 'disabled');

I tried using the above selector, but it does not work well. Here I will turn off all controls input, select and textarealeaving a viewNotive div .

Note: In the viewNotice div, I have a JqGrid. I do not want to disable jqgrid.

+3
source share
2 answers

Instead, you should use something like a modal layer. That would be much easier in many ways. However, you can try the following:

$(':input').not('#viewNotice :input').attr('disabled', true);

, , div, viewNotice ( ). (. jQuery selector API :input) , #viewNotice .

+3

Source: https://habr.com/ru/post/1770091/


All Articles