You are viewing limited content. For full access, please sign in.

Question

Question

Can I set certain colors to each row of a 3 row table?

asked on August 6, 2024

Hey all,

I have a few tables I am using in a form and they are set to always have 3 rows. However, I'd like to make each of those 3 rows a different color so it's easier on the eye for the user. Does anyone know how this can be done? I'm using the Classic Designer on this one.

I thank you in advance.

0 0

Answer

SELECTED ANSWER
replied on August 7, 2024

Give the Table the CSS Class of "ColoredRows" and the below code should do the trick.  You just need to adjust the Hex color codes to be what you want.

$(document).ready(function () {
  var iRow = 0;
  $('.ColoredRows tbody tr').each(function () {
    iRow = iRow + 1;
    if (iRow == 1) {
      $(this).css('background-color','#EFDFE0');
    } else if (iRow == 2) {
      $(this).css('background-color','#F0F5C4');
    } else {
      $(this).css('background-color','#C4F5E7');
    }
  });
});

 

2 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.