JSFiddle - React, Tailwind, and code Playground

by VixedS

HTML

<div id="alljc">
    <form class="text-center" action="#">
        <input type="checkbox" id="6" />
        <a id="link-6" href="i-aggre.php?id=6">i m ok</a>
    </form>
</div>

JavaScript

$("a[id^='link-'], a.disabled").on('click',function(e){
    e.preventDefault();
})

$('#alljc').on("change", ":checkbox", function(){
    var actId=$(this).attr('id');
    if ($(this).is(':checked')) {
        $('a#link-'+actId).off('click');
    } else {
       $('a#link-'+actId).on('click',function(e){
					e.preventDefault();
       })
    } 
});