[Solved] 3 checkboxes different names and only select one


Based on this answer by D.A.V.O.O.D, you can use jQuery for this. Just add a class (for example “abc”) to your checkboxes like:

<label><input type="radio" name="selling" value="1" class="abc" />Parduodu</label><br>
    <label><input type="radio" name="trade" value="1" class="abc" />Keičiu</label><br>
    <label><input type="radio" name="gift" value="1" class="abc" />Dovanoju</label>

and use the following jQuery:

$(".abc").each(function()
{
    $(this).change(function()
    {
        $(".abc").prop('checked',false);
        $(this).prop('checked',true);
    });
});

13

solved 3 checkboxes different names and only select one