forked from hellokaton/write-readable-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample5.js
More file actions
30 lines (28 loc) · 1.07 KB
/
Copy pathExample5.js
File metadata and controls
30 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// var update_highlight = function (message_num) {
// if ($("#vote_value" + message_num).html() === "Up") {
// $("thumbs_up" + message_num).addClass('highlighted');
// $("thumbs_down" + message_num).removeClass('highlighted');
// } else if ($("#vote_value" + message_num).html() === "Down") {
// $("thumbs_up" + message_num).removeClass('highlighted');
// $("thumbs_down" + message_num).addClass('highlighted');
// } else {
// $("thumbs_up" + message_num).removeClass('highlighted');
// $("thumbs_down" + message_num).removeClass('highlighted');
// }
// };
var update_highlight = function (message_num) {
var thumbs_up = $("thumbs_up" + message_num);
var thumbs_down = $("thumbs_down" + message_num);
var vote_value = $("#vote_value" + message_num).html();
var hi = 'highlighted';
if (vote_value === "Up") {
thumbs_up.addClass(hi);
thumbs_down.removeClass(hi);
} else if (vote_value === "Down") {
thumbs_up.removeClass(hi);
thumbs_down.addClass(hi);
} else {
thumbs_up.removeClass(hi);
thumbs_down.removeClass(hi);
}
};