Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Replace commas with wrapped div in Javascript

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(' '));
});  
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!