I have a process where I need to retain CSS styles on table rows when saved to the repository.
I have the following function. I have confirmed the values are being recorded in the "selectedValue" variable but this always results in the value being == "".
What is wrong with the below?
$('.status_copy [type="text"]').each(function(){
var selectedValue = $(this).val();
console.log(selectedValue);
if (selectedValue == "On-Time" || selectedValue == "Complete") {
$(this).closest(".cf-table-block tr").css({
'border-right': '8px solid #336600',
'border-left': '8px solid #336600',
'border-top': '1px solid #336600',
'border-bottom': '1px solid #336600',
'background-color': '#fff',
'margin-bottom': '10px'
});
} else if (selectedValue == "Delay") {
$(this).closest(".cf-table-block tr").css({
'border-right': '8px solid #f7dd07',
'border-left': '8px solid #f7dd07',
'border-top': '1px solid #f7dd07',
'border-bottom': '1px solid #f7dd07',
'background-color': '#fff',
'margin-bottom': '10px'
});
} else if (selectedValue == "Cancelled" || selectedValue == "Vessel" || selectedValue == "Missed") {
$(this).closest(".cf-table-block tr").css({
'border-right': '8px solid #e8690e',
'border-left': '8px solid #e8690e',
'border-top': '1px solid #e8690e',
'border-bottom': '1px solid #e8690e',
'background-color': '#fff',
'padding-bottom': '10px'
});
} else if (selectedValue == "") {
$(this).closest(".cf-table-block tr").css({
'border-right': '8px solid #000',
'border-left': '8px solid #000',
'border-top': '1px solid #000',
'border-bottom': '1px solid #000',
'background-color': '#fff',
'margin-bottom': '10px'
});
}
});