0

So far I've tried this code:

jQuery(document).ready(function( $ ){
if ($('.heading-title').css('color') === 'rgb(168, 168, 168)') {
    $('.heading-title').addClass('heading-title-x');
} });

This code adds the class name to each class with "heading-title". But I need to add the class name which only has this specific CSS property value.

1
  • You'll need to loop through $(".heading-title").each..., check each one then use $(this).addClass - you can't use this with your code as-is, only inside an each Commented Sep 28, 2022 at 10:47

1 Answer 1

1

Maybe you can try to see each element on document ready.

jQuery(document).ready(function( $ ){
  $('.heading-title').each(function() {
    if($(this).css('color') === 'rgb(168, 168, 168)') {
      $(this).addClass('heading-title-x');
    }
  });
});

(edited)

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.