📜  如何使用 JavaScript 从 HTML 输入元素中删除“禁用”属性?

📅  最后修改于: 2021-11-08 02:25:44             🧑  作者: Mango

任务是使用 JavaScript 从 input 元素中删除 disabled 属性。下面讨论两种方法。

方法一:选择输入元素并使用disabled属性并将其值设置为false。

  • 例子:
    
    
      
    
        
            How to remove “disabled” attribute from
            HTML input element using JavaScript ?
        
        
    
      
    
        

                  GeeksforGeeks      

        

            Click on the button to remove disabled attribute     

        Type:          
        
             

        

           
  • 输出:

方法二:选择输入元素并使用disabled属性并将其值设置为false。此示例按其类选择输入元素。

  • 例子:
    
    
      
    
        
            How to remove “disabled” attribute from
            HTML input element using JavaScript ?
        
        
    
      
    
        

                  GeeksforGeeks      

        

            Click on the button to remove disabled attribute     

        Type:          
        
             

        

           
  • 输出: