capint
5/28/2017 - 11:07 AM

JavaScript >> Collection : document.forms

JavaScript >> Collection : document.forms

const form = document.forms.IssueAdd;

<form name="IssueAdd" onSubmit={this.handleSubmit}>
  <input type="text" name="owner" placeholder="Owner" />
  <input type="text" name="title" placeholder="Title" />
  <button>Add</button>
</form>

handleSubmit(e) {
  e.preventDefault();
  const form = document.forms.IssueAdd;
  form.owner.value = "";
  form.title.value = "";
}