disable all form elements inside div

后端 未结 12 1791
栀梦
栀梦 2020-12-04 08:39

is there a way to disable all fields (textarea/textfield/option/input/checkbox/submit etc) in a form by telling only the parent div name in jquery/javascript?

12条回答
  •  庸人自扰
    2020-12-04 08:43

    Following will disable all the input but will not able it to btn class and also added class to overwrite disable css.

    $('#EditForm :input').not('.btn').attr("disabled", true).addClass('disabledClass');
    

    css class

    .disabledClass{
      background-color: rgb(235, 235, 228) !important;
    }
    

提交回复
热议问题