lundi 22 mars 2021

two checkbox and if else condition redirect to another page

I am using react js and I am looking for function that handle the checkboxes and if first checkbox is checked it will go to specific page. else if the second checkbox is checked it will redirect to another page. Anyone have idea? this is my code

<h4>Do you study in the weekend? </h4>
         <MDBCol md="4" className="mb-3">
            <div className="custom-control custom-checkbox pl-3">
              <input
                className="custom-control-input"
                type="checkbox"
                value=""
                id="yes"
                required
                checkCheckBox = {this.handleCheckBox}
                

              />
              <label className="custom-control-label" htmlFor="yes">
Yes </label>        
            </div>
          </MDBCol>

          <MDBCol md="4" className="mb-3">
            <div className="custom-control custom-checkbox pl-3">
              <input
                className="custom-control-input"
                type="checkbox"
                value=""
                id="no"
                required
                checkCheckBox = {this.handleCheckBox}

              />
              <label className="custom-control-label" htmlFor="no">
No</label>        
            </div>
          </MDBCol>



Aucun commentaire:

Enregistrer un commentaire