0

I am trying to assign pseudo to the checkbox dynamically as below the color is not updating to the checkbox, please suggest

item.color = item.options.color;
$('input[type=checkbox]:checked + label::before').css("background-color", item.color);

Below is the CSS for reference where I am planning to put in jQuery as above:

input[type=checkbox]:checked + label::before {background-color:rgb(186,135,200);
  border: none;box-shadow: none;}
1

1 Answer 1

2

Pseudo elements like :before or :after should have content property specified or will not be rendered:

input[type=checkbox]:checked + label::before {
    content: " ";
    background-color:rgb(186,135,200);
    border: none;
    box-shadow: none;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.