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

104
Views
Removing the comment section from the youtube video page

im trying to make a Userscript that removes the comments from the Youtube video page but cant get it to work i tried a lot of methods but keep getting different errors that lead into other errors and stuff

window.addEventListener('load', (event) => {
setTimeout(function(){
  document.document.querySelector("#comments")[0].remove()
}, 2000);
  });

i also tried this version

(function () {
    window.addEventListener('load', function () {
      setTimeout(() => {(function () {
        var CommentSection = document.querySelector("#comments");
        if (CommentSection) {
          CommentSection.parentNode.removeChild(CommentSection);
        }
      })})
    }, false);
    console.log("should be removed //")
  })()

but both give errors the hard thing is that the comments dont load immediately but load slowly and separately

thanks in advance

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Inserting a CSS rule that hides the section would be easier.

document.body.appendChild(document.createElement('style')).textContent = '.ytd-comments { display: none; }';

The .ytd-comments is the container for all the comments on a video, so setting it to display: none will hide it.

about 4 years ago · Juan Pablo Isaza Report
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!