Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8299019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:59:51+00:00 2026-06-08T15:59:51+00:00

I found this problem mentioned before here jQuery/Javascript to replace broken images and this

  • 0

I found this problem mentioned before here jQuery/Javascript to replace broken images

and this was the best answer.. I tried it and it’s working fine

function ImgError(source){
   source.src = "/images/noimage.gif";
   source.onerror = "";
   return true;
}

<img src="someimage.png" onerror="ImgError(this);"/>

but when I tried to preform other events in the previous function

function ImgError(source){
   source.hide(); // hide instead of replacing the image
   source.onerror = "";
   return true;
}

I got this error

TypeError: 'undefined' is not a function (evaluating 'source.hide()')

Every single jQuery event/method I tried that function I got a TypeError.

What’s the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:59:53+00:00Added an answer on June 8, 2026 at 3:59 pm

    Because .hide() is a jQuery element.

    Try that:

    function ImgError(source) {
       $(source).hide();
       source.onerror = "";
       return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I'm quite new to jQuery, but found this bizzare problem just now,
Searched a lot about this problem but never found a answer, that solved it.
edit: As mentioned in my comment I found out the reason for this problem
I found this problem in a book. Problem: What is the output of the
Possible Duplicate: Can main function call itself in C++? I found this problem very
I am using a NamedParameterJdbcTemplate, but found that this problem is in the underlying
i have this problem: ms-access could not delete and i found a potential solution
Already found this page with some helpful hints. Problem is I need to debug
Although I have found some solutions to this problem, none of them refer to
This problem pops around the network for years, I've found no good solution yet.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.