ama
ama

Reputation: 51

read the value of a label onchange of input field

  handleChange: function() {  
  }; 
  render: function() {
      return (
          <label>inputdate</label>
          <input type="text" onchange={this.handleChange.bind(this)} />         
          <label value="10/20/2018">Outputdate</label>                
      );

how can I read output date value on change of inputdate

Upvotes: 0

Views: 573

Answers (1)

Code-Apprentice
Code-Apprentice

Reputation: 83527

  1. If the date is hardcoded in your component, then you don't need to get the value from the label. You just hardcode it in the handleChange() function as well.

  2. If the date is not hardcoded in your component, then you should be passing it in as a prop. Here you also don't need to get it's value because you can access it directly with something like this.props.outputdate.

Upvotes: 1

Related Questions