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

  • SEARCH
  • Home
  • 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 6769009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:08:31+00:00 2026-05-26T15:08:31+00:00

i have this html: <ul class=cont_ul4> <li class=cont_li> <div class=cont_picture> <a href=><img src=1.jpg width=150

  • 0

i have this html:

<ul class="cont_ul4">

<li class="cont_li">
<div class="cont_picture">
<a href=""><img src="1.jpg" width="150" height="225" ></a>
</div>
</li>

<li class="cont_li">
<div class="cont_picture">
<a href=""><img src="2.jpg" width="150" height="225" ></a>
</div>
</li>

</ul>

and this function:

function ajax_request() {
$('#placeholder').html('<p><img class="loader" src="/loader.gif"></p>');
$('#placeholder').load("/test.php?id=1234556");
}

what i need is when i click on the image to trigger this function.

with an input button i could do this:

<input type="button" onclick="ajax_request()" value="Click Me!" />

any ideas?
Thanks

  • 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-05-26T15:08:31+00:00Added an answer on May 26, 2026 at 3:08 pm

    Give your image an id:

    <img id="myImage" src="1.jpg" width="150" height="225" style="cursor:pointer">
    

    Then in Javascript:

    $("#myImage").click(ajax_request);
    

    Or if you want to run the same function for all images:

    $("img").click(ajax_request);
    

    However it would be better to give your images a CSS class and then use that. That way you can restrict the click action to specific images:

    <img class="link-image" src="1.jpg" width="150" height="225">
    ...
    <img class="link-image" src="2.jpg" width="150" height="225">
    

    Then:

    $(".link-image").click(ajax_request);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this piece of HTML <div id=fileTreeInviati> <ul class=php-file-tree> <li class=pft-directory> <a href=#
HTML: <li class=comment> <div class=p_comm> <div class=avatar><img src=/img/1.jpg></div> <div class=c_auth>author<a class=del title=delete it! rel=19>x</a></div>
If I have this html on my page <img src=samesrc class=commentimg name=differentimg1/> How onclick
I have this html-code: <div class=im> <div style=height:220px>HELLO WORLD! <a class=close>X</a> <a class=open style=display:none;>V</a>
I have this HTML <li> <a rel=1 href=/jobwall/job/1> <img src=http://lcl.moovjob.com/media/images/employers/simonainleydotinfo.jpg> </a> </li> and I
I have this HTML code: <div id=content> <div class=profile_photo> <img style=float:left;margin-right:7px; src=http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=50&d=identicon class=profile_img alt={username}/>
I have this html code <div id=b_container> <div id=b_header> <div class=header_left><a href=#>link 1 </a></div>
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{

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.