Add disabled attribute to input element using Javascript

后端 未结 7 643
执念已碎
执念已碎 2021-01-30 00:44

I have an input box and I want it to be disabled and at the same time hide it to avoid problems when porting my form.

So far I have the following code to hide my input:<

7条回答
  •  春和景丽
    2021-01-30 01:16

    Working code from my sources:

    HTML WORLD

    
    

    JS WORLD

    var from = jQuery('select[name=select_from]');
    
    //add disabled
    from.attr('disabled', 'disabled');
    
    
    
    //remove it
    from.removeAttr("disabled");
    

提交回复
热议问题