SOLVED - How to toggle checkbox?

I have 2 checkboxes with the same data-id and I show an list dialog when I click/toggle the checkbox and when I click cancel on the dialog/alert then I want to set the checkbox to unchecked.

So if I have clicked on the one with value=Nr1 then I want to uncheck that one.

<label class="toggle">  
              <input type="checkbox" name="Claes" class="registrera" value="Nr1" data-id="123"  checked>
              <span class="toggle-icon"></span>  
</label>
<label class="toggle">  
              <input type="checkbox" name="Claes" class="registrera" value="Nr2" data-id="123" >
              <span class="toggle-icon"></span>  
</label>

This is what I run when I click cancel.
If I use this then the wrong one is toggled offcourse, but how should I do it?
How do I find the one with data-id=123 and value=Nr1?
$$(page.el).find('.registrera[data-id="123"]').removeAttr('checked');

Any input appreciated, thanks.

$$(page.el).find('.registrera[data-id="123"]').prop('checked', false);
2 Likes

Thanks a lot Vladimir, I figured it out :slight_smile: