Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

disable a button react

// Input field listens to change, updates React's state and re-renders the component.
<input onChange={e => this.setState({ value: e.target.value })} value={this.state.value} />

// Button is disabled when input state is empty.
<button disabled={!this.state.value} />
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #disable #button #react
ADD COMMENT
Topic
Name
8+4 =