How to disable all <input > inside a form with jQuery?

后端 未结 8 1270
感动是毒
感动是毒 2021-01-29 22:35
....
8条回答
  •  长情又很酷
    2021-01-29 23:08

    You can do it like this:

    //HTML BUTTON
    
    
    //Jquery function
    function disableAll() {
        //DISABLE ALL FIELDS THAT ARE NOT DISABLED
        $('form').find(':input:not(:disabled)').prop('disabled', true);
    
        //ENABLE ALL FIELDS THAT DISABLED
        //$('form').find(':input(:disabled)').prop('disabled', false);
    }
    

提交回复
热议问题