mercredi 7 décembre 2016

onchange don't work on checkbox when there are multiple check

I have many checkbox with onchange event that change line color where is checked :

<input type="checkbox" onchange="cocheCommande($(this))" name="${NAME_SELECTION}" value="<%=command.getCdeId()%>"  />

function cocheCommande(chk)
{
    alert("test cocheCommande");
    var tr=chk.closest('tr');

    if (chk.is(':checked'))
    {
        tr.css('background','#33EE33');
        tr.nextUntil("tr.entete","tr").css('background','#FFFF33');
    }
    else
    {
        tr.css('background','#D0EED0');
        tr.nextUntil("tr.entete","tr").css('background','#EEEED0');
    }
}

I have a function that allows to check everything or uncheck. But if I use, onchange event is never call even though everything is checked. Why ? And how can I do ?




Aucun commentaire:

Enregistrer un commentaire