vendredi 11 mars 2016

Checkbox label is blocking redirect behaviour of a link

I'm having a setup, where I'm using a checkbox more as a UI style element, rather than using its actual behaviour.

<a href="link/to/certain/query">
  <label>
    Redirect
    <input type="checkbox">
  </label>
</a>

when I'm clicking the checkbox, I get redirected to the URL provided. But when I'm clicking on the label of the checkbox, which is clearly within the a-tag, nothing happens. Does anyone know about this behaviour and how to make the label hitting the href as well? Note: I don't want to use JS at all.

Fiddle here (check console to see it hits the redirect)

Happy to hear a solution in order to have the checkbox triggering a redirect without using JS.




Aucun commentaire:

Enregistrer un commentaire