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

Question

Question

Forms: How to maintain table row color when saving file to repository

asked on October 19, 2018 • Show version history

Each row in my table changes color based on the priority radio button selected, High, Medium or Low. How can I have the resulting file, which is saved to the repository, maintain the TR color/CSS styling?

$(document).ready(function () {  
   
// ==================================================
// CHANGE ROW COLOUR BASED ON PRIORITY SELECTION 	
// ==================================================   
  
  $('.aircraftTable').on('change','.priority input:radio', function() { 
    
    if ($(this).val() == "high")
    {        
        $(this).closest("tr").addClass("highRow"); 
    }
    else {
      	$(this).closest("tr").removeClass("highRow"); 
    }
      
    if ($(this).val() == "med")
    {
        $(this).closest("tr").addClass("medRow"); 
    }
    else {
      	$(this).closest("tr").removeClass("medRow");  
    }
    
    if ($(this).val() == "low")
    {
        $(this).closest("tr").addClass("lowRow");  
    }
    else {
      	$(this).closest("tr").removeClass("lowRow"); 
    }
  });
  
  
// ==================================================
// END
// ==================================================  
  
});  

0 0

Replies

replied on October 19, 2018

I had a similar scenario a few months ago and discovered after some testing that the css changes will hold if you apply them "inline" instead of using classes.

So for example:

 $("#q188 input").change(function(){
    $("#q188").css('background-color', 'LightSeaGreen');
    $("#q188 span label").css('color', 'white');
  });

 

Of course you can target classes or id's like you have done, but make sure you use Javascript's css property to set them.

 

Let me know if that helps!

 

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

Sign in to reply to this post.