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

233
Views
Using Jquery to fade out any element which is clicked on

Im still very new to jQuery and im not sure why this is not working. I want to fade out any element which is clicked on using using jQuery.

html:

<head>
  
  <script src="https://code.jquery.com/jquery-3.6.0.js"></script>

  <script src="basicFile.js" defer></script>
  <title>fade Out any clicked on element</title>
</head>
<body>
  <p>
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sed magnam nisi animi itaque labore tempore porro iure
    amet accusamus? Eos, similique! Maxime maiores totam rem!
  </p>
  <div>enter code here
    this is another paragraph
  </div>
</body>

Script:

$(document).ready(
  $('*').on('click',
    () => $(this).fadeOut(2500)
  )
)

I have also tried:

$(document).ready(
  $('*').click(
    () => $(this).fadeOut(2500)
  )
)
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

$(document).on('click','#elementID', function (){
               $(this).fadeOut();})
about 4 years ago · Juan Pablo Isaza Report

0

I guess you need something like this:

$(document).ready(function() {
    $(this).click(function(event) {
         $(event.target.id).fadeOut(2500);
    });
});
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!