Add disabled attribute to input element using Javascript

后端 未结 7 606
执念已碎
执念已碎 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

    <select name="select_from" disabled>...</select>
    

    JS WORLD

    var from = jQuery('select[name=select_from]');
    
    //add disabled
    from.attr('disabled', 'disabled');
    
    
    
    //remove it
    from.removeAttr("disabled");
    
    0 讨论(0)
提交回复
热议问题