HI,
Ive got the following question. I've got several partial views. Ech partial view has a value CollectorValue.Based on the Collector Value the partialview schould get the background color red (failed) or green( completed). However for some reason it is only looking at the first item. So when that is failed all the partial views turn on red and when that is green all the partial views turn on green instead of looking at each CollectorValue of the partialview and make it green or red. My question is how can i fix this (please send me the good javascript code)? that it really checks of value CollectorValue of all the partialviews instead of only the first.
Here is my script:
- $("#conditionalOn").click(function () {
- var countCompleted = 0;
- var countFailed = 0;
- $('#collector tr').each(function () {
- var waarde = $("#collectorValue").text()
- if (waarde == "Failed") {
- $(this).css('backgroundColor', '#f76e6e');
- countFailed = countFailed + 1;
- }
- if (waarde == "Completed") {
- $(this).css('backgroundColor', '#99faa0');
- countCompleted = countCompleted + 1;
- }
- });
- event.preventDefault();
- }) ;