I know that there are many topics for checking a checkbox by clicking on href, but in every solution I saw, you cannot check the box by clicking this checkbox because it is wrapped with a tag <a>.
There is my html :
<a href='#' id='cb'>mode<input type='checkbox' id='mode'></a>
My jQuery :
$("#cb").click(function(e) {
e.preventDefault();
$("#mode").prop("checked", !$("#mode").prop("checked"));
})
What I need :
I need to check the box by clicking on the href link AND by clicking on the box.
If this message is repeated, sorry, but I did not see it, I will contact me and I will delete it.
Jsfiddle
source
share