Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Change the colors of items according to Choice Column values in List Calendar View

$
0
0

I have added a Tasks application. It contains 3 views of lists (Upcoming, Completed, All Tasks) and a list Calendar view.

I created a list column "Task Priority" that has choices: High, Normal, Low.

In a list Calendar view I want to have different colors for items.

So far I have tried code snippets that I found on internet but they are very complication and not really working for me. I found that applying this CSS works:

<style type="text/css">
div.ms-acal-item {
 background-color: #288054;
}
</style>

It changes the color of all items to green color. What JavaScript code should I use to change the color to green only to these items that have a Task Priority set to Low? 

I am stuck with the code snippet here:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if($('ms-acal-title:contains("Low")')){
$("ms-acal-item").css("background-color", "#288054");
}});
</script>

Is there a simple JavaScript code that finds the items, and checks if they have a Task Priority set to Low then it changes the background color of the item to green?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>