jeudi 8 décembre 2016

Disable cursor:pointer for labels of disabled checkboxes

I am trying to have cursor:pointer on my checkboxes and their labels.

Here's the code that I use - but I want to avoid having cursor:pointer on checkboxes and their labels that are disabled.

HTML looks like this:

<label>
    <input 
        type="checkbox"
        ...more attributes...
        > Yes, please specify:
</label>

CSS:

input[type=checkbox]:not([disabled]), 
label + input[type=checkbox]:not([disabled]) {
    cursor: pointer;
}

The way I set it as disabled is using jQuery:

$("selector").prop("disabled", true);
$("selector").prop("disabled", false);

It seems I can't find a way to select <label> that contains a disabled checkbox.

Ideas?

Thank you.




Aucun commentaire:

Enregistrer un commentaire