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 8596329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:39:02+00:00 2026-06-12T00:39:02+00:00

I have an image displaying using the jquery. When mouse over to that image,

  • 0

I have an image displaying using the jquery. When mouse over to that image, I like the mouse to change to be clickable and when clicked, I like to load another image. This is my code and not working. Any ideas?

html code:

jquery code:

$("#div1").click(function () {
    var img_cpu = "http://192.168.101.1/cpu.png";
    var myImage = new Image();
    $(myImage).load(function () {
        $("#div2").html(myImage)    
    }).error(function () {
        $('#div2').hide();
    })
    .attr('src', img_cpu)
});
  • 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-12T00:39:03+00:00Added an answer on June 12, 2026 at 12:39 am

    some issues occurred

    • you created a new image var myImage = new Image(); but you didn’t specified a src later (so load event never triggers)

    • myImage32 is not defined anywhere in your code

    furthermore be sure that cpu.png

    • is inside the same folder
    • has minimum permission (644) to be viewed
    • is not already cached, otherwise load event could never occur: in this case you should check for complete property and trigger the handler defined for load event (see snippet below)

     $(myImage).one('load', function () {   /* use one() */
         $("#div2").html(myImage32)    
     })
     .attr('src', img_cpu);
    
     if (!!myImage.complete) $(myImage).trigger('load');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Helo folks., i am using jquery.cycle plugin for displaying image gallery.. i have a
I have a view that will be displaying downloaded images and text. I'd like
I have image map that can I move, but this map will be so
I have some (OpenCV) code that generates images. I'm displaying these using OpenGL. When
hi i have a function that worked fine using jQuery 1.3.2 but now i
Hi i am using jquery jCarousel for displaying images but problem is that i
I have a question about the images displaying using a function getImage_w($image,$dst_w), which takes
I have a table structure for displaying posts like this: <table> <tr><td>heading of the
This is a very common scenario: displaying images in a ListView which have to
I have this PHP script which i'm grabbing images from a directory and displaying

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.