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

390
Views
I tried converting Jquery to Vanilla JS, but its not working

I have this Jquery and trying to convert to pure JS. Can someone help?

    (function($) {
    $(".comments-content > ol > .comment").each(function() {
        var str = $(this).children(".comment-block").find(".comment-header > .name > span").text();
        $(this).find(&quot;.comment-avatar&quot;).append(&quot;<span>&quot; + str.charAt(0) + &quot;</span>&quot;);
    });  
    })(jQuery);

So far, I have reached here:

var elements = document.querySelectorAll(&quot;.comments-content &gt; ol &gt; .comment&quot;);
Array.prototype.forEach.call(elements, function(){
let str = this.children(&quot;.comment-block&quot;).find(&quot;.comment-header &gt; .name &gt; span&quot;).innerText;
        this.querySelectorAll(&quot;.comment-avatar&quot;).append(&quot;<span>&quot; + &quot; str.charAt(0) &quot; + &quot;</span>&quot;);
});
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!