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

183
Views
Display "search again" when the result is empty using JavaScript

I created a dropdown menu filter using JavaScript.

I want to display "Search Again" when the result is empty.

i.e. if the return result is "null", then write.document("search again").

I appreciate you taking time to help me!


<script>
  $("select.grade, select.type, select.subject").change(update);

  function update() {
    var resourceGrade = $('select.grade').val();
    var resourceType = $('select.type').val();
    var resourceSubject = $('select.subject').val();
        
    $('.property-load-section')
      .find('.property-item')
      .hide()
      .filter(function() {
        var okResourceGrade = true;
        if (resourceGrade !== "all") {
          okResourceGrade = 
            $(this).attr('data-grade') === resourceGrade;
        }
              
        var okResourceType = true;
        if (resourceType !== "all") {
          okResourceType = $(this).attr('data-type') === resourceType;
        }
              
        var okResourceSubject = true;
        if (resourceSubject !== "all") {
          okResourceSubject = 
            $(this).attr('data-subject') === resourceSubject;
        }
              
        var result = okResourceGrade && okResourceType && 
                     okResourceSubject;
        if (result === null) {
          document.getElementById("searchagain").style.display = "block";
        }
        return result;
      })
      .fadeIn('fast');            
  }
</script>
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!