I know this is duplicate question to other, however I have problem pertaining why their is no value output in my console.
My Goal: I want to get the value of checkbox.
I have here my codes.
State:
employ_status:''
Constructor:
this.handle_employ_status = this.handle_employ_relocate.bind(this);
Handle:
handle_employ_status(e){
console.log(e.target.checked, e.target.name);
}
JSX:
<div className="form-check-inline disabled">
<label className="form-check-label">
<input
type="checkbox"
className="form-check-input"
name="employmentstatus"
onChange={this.handle_employ_status}
defaultChecked={false}
value="Self-Employed"/>Self-Employed
</label>
</div>
<div className="form-check-inline disabled">
<label className="form-check-label">
<input
type="checkbox"
className="form-check-input"
name="employmentstatus"
onChange={this.handle_employ_status}
defaultChecked={false}
value="Student"/>Student
</label>
</div>
Console:
console.log(this.state.employ_status);