lundi 14 septembre 2020

Pre-fill the checkbox with url

I understand that we can pre-fill some data in a HTML form using the URL. For example, www.example.com/?itemname=sth

May I know would there be a similar way for me to pre-check a checkbox through the URL?

<ul class="list-group">
   <li class="list-group-item">
       <div class="form-check">
          <label class="form-check-label">
            <input type="checkbox" class="form-check-input product_check" id="Tutor_subject_1" value="Maths">Maths<br>
          </label>
        </div>
    </li>
</ul>

Thank you @jrswgtr. I have one more follow up question. The above setting is actually the filter of my result page. Your solution is workable but it simply checked the box but doesn't pass the value of the selected items to my SQL like it usually does. May I know how could i change it?




Aucun commentaire:

Enregistrer un commentaire