I was wondering how to change the following:

<li class="link">
<a href="https://some-url.com">Some Text</a>

In a way that I can have a text with a squared box, so that when I click on the box, I am redirected to the same url specified in the tag. If I click on the text, the box should be selected as well.


Something like this?


<input id="mycheckbox" type="checkbox" onclick="location.href = 'https://some-url.com';">
  <a id="linkid" href="https://some-url.com">SomeText</a>


  function() {
    $('#mycheckbox').prop('checked', true);


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.