How to display SharePoint list item status values into images/icons using simple JavaScript
src="http://code.jquery.com/jquery-latest.min.js"
$(document).ready(
function() {
$('td.ms-vb2:contains("Completed"), ' +
'td.ms-vb2:contains("Pending")').each(
function() {
$(this).hide();
$(this).html(ReplaceColorTextWithImage($(this).html()));
$(this).show("slow");
}
);
}
);
function ReplaceColorTextWithImage(strColorText) {
var strColorImage = "";
switch(strColorText) {
case "Completed":
strColorImage = "green";
break;
case "Not Started":
strColorImage = "Red";
break;
}
return ""
}
return "$$>";
function() {
$('td.ms-vb2:contains("Completed"), ' +
'td.ms-vb2:contains("Pending")').each(
function() {
$(this).hide();
$(this).html(ReplaceColorTextWithImage($(this).html()));
$(this).show("slow");
}
);
}
);
function ReplaceColorTextWithImage(strColorText) {
var strColorImage = "";
switch(strColorText) {
case "Completed":
strColorImage = "green";
break;
case "Not Started":
strColorImage = "Red";
break;
}
return ""
}
return "$$>";
Credit /Source
http://www.dalesandro.net/replace-text-with-images-in-sharepoint-view-using-jquery/
Using Jequery
https://www.sharepointusecases.com/2014/04/replacing-strings-icons-list-view-jquery-sharepoint-2010/
Comments
Post a Comment