Disable button whenever a text field is empty dynamically

前端 未结 5 1016
不知归路
不知归路 2020-12-03 21:43

Here\'s my code:

 0) document.getElementById(\'start_button\').disabled = false; else document.get         


        
5条回答
  •  佛祖请我去吃肉
    2020-12-03 22:19

    Add a check when the button is clicked to see if there is any text. If there isn't, pop up an alert box (or some other form of feedback) to tell the user to enter data, and don't do the button functionality.

    Example:

    
     
    
    
    

提交回复
热议问题