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

108
Views
Javacript click function for specific location with image

if you click on the tiger name button then the box image should be changed to the tiger image. same for the next 2 buttons. also, create 1 reset button to remove the box image and then display any default image in the box. also, create 1 button to show the name of the image present in this image box. (result shown in an alert box.).

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

0

a little more context would be desirable. Your question is a bit confused. Please post your code next time. If I understood correctly, you can solve this with JavaScript:

Assuming you have your image tag and three buttons

<img id="tigerImage" alt="this is the tigers name" src="/assets/images/placeholder.jpg">
<button onclick="setImage()">Set Image</button>
<button onclick="resetImage()">Reset Image</button>
<button onclick="showName()">Show Name</button>

The id is important, you can address it with JS:

Vanilla JS:

function setImage() {
 document.getElementById("tigerImage").src="/assets/images/tiger.jpg";
}
function resetImage() {
 document.getElementById("tigerImage").src="/assets/images/placeholder.jpg";
}
function showName() {
    var imageName = document.getElementById("tigerImage").alt;
    alert(imageName);
}
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!