I have code like this. And would like to replace the , and wrap each word in a div. And adding line-breaks would be a plus.
<div class="utility">
Analysis,Arrears/Final Notice Communications,Automated Legal Processing
</div>
I would like it to look like this:
<div class="utility">
<div class="something">Analysis</div><div class="something">Arrears/Final Notice Communications</div><div class="something">Automated Legal Processing</div>
</div>
Is this possible with Javascript? And How? Thanks in advance
Im adding this in Wordpress in the Footer script to run.
Someone suggested this similar solution but did not work for me:
$('.hero_image p').each(function(){
var text = $(this).html().split(' '),
len = text.length,
result = [];
for( var i = 0; i < len; i++ ) {
result[i] = '<span>' + text[i] + '</span>';
}
$(this).html(result.join(' '));
});