Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
foreach loop doesnt work how i was suspecting
Cassie Mod
Feb 4 2016 11:38 AM
709
Reply
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();
}) ;
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
GET website screen shot using c#
playing .m3u8 files in media element in wpf