TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cassie Mod
NA
488
71.1k
foreach loop doesnt work how i was suspecting
Feb 4 2016 11:38 AM
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();
}) ;
Reply
Answers (
9
)
process.start not working in iis7
How much time spend to make a junior asp.net developer