-1

I have a table which has the column name "12" Instead of that value I want to pass it dynamically and for that I have a created item "P_Itm_val" see attached image for reference.

$('td[headers = "12"]').each(function() {
    $(this).css({"background-color":"whitesmoke"});  
    $(this).css({"color":"green"});
    $(this).css({"font-weight":"bold"});
  });

image

1
  • 4
    Ask question clearly with input and out samples. Commented Dec 28, 2022 at 4:37

1 Answer 1

0

Just put the value there instead of "10"

 $('td[headers = P_Itm_val]').each(function() {
     $(this).css({"background-color":"whitesmoke"});  
     $(this).css({"color":"green"});
     $(this).css({"font-weight":"bold"});
 });

If that doesn't work, try appending the value into the call

 $('td[headers = "'+P_Itm_val+'"]').each(function() {
     $(this).css({"background-color":"whitesmoke"});  
     $(this).css({"color":"green"});
     $(this).css({"font-weight":"bold"});
 });

I'm not quite sure what I did for this however, I've done something similar to this.

10
  • both of them are not working
    – shajin
    Commented Dec 28, 2022 at 5:01
  • I've updated the 2nd one to have double quotes around it. I'm assuming P_Itm_val is a string but has a number in it.
    – Dale
    Commented Dec 28, 2022 at 5:03
  • P_Itm_val is a page item and value in that has a string datatype
    – shajin
    Commented Dec 28, 2022 at 5:05
  • What value is in it? Is it a number?
    – Dale
    Commented Dec 28, 2022 at 5:06
  • 1
    The concatenation solution looks fine. Perhaps add a debug statement to check the value of P_Itm_val
    – Scott
    Commented Dec 29, 2022 at 2:40

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.