I have the following code (using XSLT/HTML)
<div class="{@ClassName} modify""><img src="{substring-before(@Image, ', ')}"/></div>
The "ClassName" is being through dynamically through a CMS, which when there are two options selected, they are segregated by a bunch of other characters. As a result you end up with something similar to this:
;#class1;#class2;#
What I'm trying to do is modify the class names based on what they are currently set to. I written the following code, which when entered into the browsers console window, works an absolute charm. However, when added to the actual page, it doesn't take effect. I'm wondering if it's a priority thing or something else:
$('.modify').each(function(){
var newPrimeItem= "primary item";
var newItem = "item";
if ( $(this).attr('class') == ";#primary;#item;# modify") { $(this).attr('class', newPrimeItem);}
if ( $(this).attr('class') == ";#item;# modify") { $(this).attr('class', newItem );}
});
Any help on this would be greatly appreciated.
Thanks in advance :)