How to follow the link and remember the checkbox?

  • 0
    Guys, tell me, please, there is such a list:

    in html it is done like this:
    <a class="filters-check__link" id="1" href="">
        <input class="filters-check__checkbox" type="checkbox" id="1">
        <label class="filters-check__label" for="1">Apple</label>

    It's just that when I click on the brand name on the link, I go without any problems, I need that when I click the checkbox, I also go to the link, and also remember the selected checkbox, please tell me how you can do this?

    P.S each brand has its own unique ID, as I understand it, you can check if such an ID exists in the link, then we put the chekbox, if it does not exist, then we don’t, I understand correctly?
    JavaScript Anonymous, May 9, 2019

  • 2 Answers
  • 0
    On the server, you check which link was followed, and, on its basis, set the `checked` attribute to the required input

  • 0
    If you need to save information about a click on a checkbox on the client, then you can do something like this


Your Answer
To place the code, please use CodePen or similar tool. Thanks you!