There are several approaches you can take to solve this issue.
Personally, I prefer sending the correct label directly from the server.
If that's not an option, you could utilize the following jQuery script: http://jsfiddle.net/ehdgL6so/
// Optimize for speed by selecting minimal elements
var labels = jQuery('label');
// Iterate through all labels
labels.each(function() {
// Get individual label element
var label = jQuery(this);
// Retrieve content of label (e.g., "TV:")
var labelContent = label.text();
// Replace based on label content
switch(labelContent) {
case 'TV:':
// Replace label with <i> element if it contains "TV:"
label.replaceWith('<i class="fa fa-film fa-2x"></i>');
break;
case 'Foo':
// Replace "Foo" with <i> element
label.html('<i class="fa fa-film fa-2x"></i>');
break;
}
});
Edit:
Alternatively, as suggested by @cforcloud, use a concise form like:
// Note: .html only replaces the string "TV:" without removing the label element from the DOM; use replaceWith to replace the entire element
// http://api.jquery.com/replacewith/
jQuery("label:contains('TV:')").replaceWith('<i class="fa fa-film fa-2x"></i>');