Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

form- text area react

class EssayForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: 'Please write an essay about your favorite DOM element.'
    };

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.setState({value: event.target.value});
  }

  handleSubmit(event) {
    alert('An essay was submitted: ' + this.state.value);
    event.preventDefault();
  }

  render() {
    return (
      <form onSubmit={this.handleSubmit}>
        <label>
          Essay:
          <textarea value={this.state.value} onChange={this.handleChange} />
        </label>
        <input type="submit" value="Submit" />
      </form>
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: find vowels in string javascript 
Javascript :: how to proxy enable in server nodejs 
Javascript :: check a letter in astring js 
Javascript :: react native geocoding 
Javascript :: inline style to change background color js 
Javascript :: promise 
Javascript :: set state 
Javascript :: launch.json 
Javascript :: words counter in javascript 
Javascript :: mongoose express js post 
Javascript :: function js 
Javascript :: google maps address autocomplete in angular npm 
Javascript :: javascript Symbol Methods 
Javascript :: How to include route handlers in multiple files in Express 
Javascript :: wild card select jquery 
Javascript :: javascript console log 
Javascript :: get width of html photo 
Javascript :: find the largest array from an array in javascript 
Javascript :: find number in array js 
Javascript :: sort array descending 
Javascript :: write head node js 
Javascript :: jQuery - Chaining 
Javascript :: map function in js 
Javascript :: every element in list after first javascript 
Javascript :: iterating over a string 
Javascript :: skip method js 
Javascript :: named parameters 
Javascript :: all jquery selectors 
Javascript :: javascript array slice() example 
Javascript :: Format javascript date with date.js library 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =