Michitect Posted September 20, 2016 Report Share Posted September 20, 2016 Only the first content in my list (for example with the word "Aangeworven") dynamically changes the background color of the row. What should I do if I want to change ALL the lines to green, with the content "Aangeworven"? <a id="visi[@field:Status]"> <script> var isi = document.getElementById("visi[@field:Status]"); if('[@field:Status]' == 'Aangeworven'){ isi.parentNode.parentNode.style.backgroundColor = '#b3e6b3'; } if('[@field:Status]' == 'Te scouten'){ isi.parentNode.parentNode.style.backgroundColor = '#ffdab3'; } if('[@field:Status]' == 'Afgekeurd'){ isi.parentNode.parentNode.style.backgroundColor = '#ffb3b3'; } </script> Quote Link to comment Share on other sites More sharing options...
0 Mathilda Posted September 27, 2016 Report Share Posted September 27, 2016 On 9/20/2016 at 8:41 PM, Michitect said: Only the first content in my list (for example with the word "Aangeworven") dynamically changes the background color of the row. What should I do if I want to change ALL the lines to green, with the content "Aangeworven"? <a id="visi[@field:Status]"> <script> var isi = document.getElementById("visi[@field:Status]"); if('[@field:Status]' == 'Aangeworven'){ isi.parentNode.parentNode.style.backgroundColor = '#b3e6b3'; } if('[@field:Status]' == 'Te scouten'){ isi.parentNode.parentNode.style.backgroundColor = '#ffdab3'; } if('[@field:Status]' == 'Afgekeurd'){ isi.parentNode.parentNode.style.backgroundColor = '#ffb3b3'; } </script> Hi Michitect, I suppose, you need to leave only the first 'if' statement: <a id="visi[@field:Status]"> <script> var isi = document.getElementById("visi[@field:Status]"); if('[@field:Status]' == 'Aangeworven'){ isi.parentNode.parentNode.style.backgroundColor = '#b3e6b3'; } </script> Quote Link to comment Share on other sites More sharing options...
0 aam82 Posted September 27, 2016 Report Share Posted September 27, 2016 Here is a previous thread on the subject. Quote Link to comment Share on other sites More sharing options...
0 Meekeee Posted January 15, 2019 Report Share Posted January 15, 2019 Hi @Michitect, You may refer to this article to change the background color of the row: https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/ I hope this helps! Quote Link to comment Share on other sites More sharing options...
0 Meekeee Posted January 12, 2022 Report Share Posted January 12, 2022 This new post might help as well: Quote Link to comment Share on other sites More sharing options...
Question
Michitect
Only the first content in my list (for example with the word "Aangeworven") dynamically changes the background color of the row.
What should I do if I want to change ALL the lines to green, with the content "Aangeworven"?
<a id="visi[@field:Status]">
<script>
var isi = document.getElementById("visi[@field:Status]");
if('[@field:Status]' == 'Aangeworven'){
isi.parentNode.parentNode.style.backgroundColor = '#b3e6b3';
}
if('[@field:Status]' == 'Te scouten'){
isi.parentNode.parentNode.style.backgroundColor = '#ffdab3';
}
if('[@field:Status]' == 'Afgekeurd'){
isi.parentNode.parentNode.style.backgroundColor = '#ffb3b3';
}
</script>
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.