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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:29:29+00:00 2026-06-15T10:29:29+00:00

I have a list which has a jquery handler for a mouse click. I

  • 0

I have a list which has a jquery handler for a mouse click. I need to place an image within the list, but need a mouse click on the image to perform a different function. I was thinking some sort of unbind on mouseover and bind on mouseout but can not get it to work. Is there an easier method?

The problem I am having is it performs the two clickable events when I click the image.

JS

$(function () {
var items = $('#v-nav>ul>li').each(function (index) {
$(this).click(function () {
    alert("This is a click on the list")
}
});
});

html

<li id="tab" runat="server">Keywords <a class="fake-link" onclick="alert("This is an image click")"><img id="icon" src="images/icon.gif" style="float: right; visibility:visible"/></a></li>

So any ideas how I can only have the alert from the image click? Thanks in advance!

  • 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-15T10:29:30+00:00Added an answer on June 15, 2026 at 10:29 am
    $(function () {
    var items = $('#v-nav>ul>li').each(function (index) {
    $(this).click(function (e) {
    if($(e.target).attr('id')==='icon')){
    //call that function which runs on image click
    }
    else {
        alert("This is a click on the list")
    }
    }
    });
    });
    

    Edit: As puppybeard suggested here is another way if you want to have different function to run for all images in the li’s

    $(function () {
        var items = $('#v-nav>ul>li').each(function (index) {
        $(this).click(function (e) {
        if($(e.target).is('img'))){
        //call that function which runs on image click
        }
        else {
            alert("This is a click on the list")
        }
        }
        });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a <select> list, which has been populated with several options, but want
I have a list which has repeating items and I want a list of
I have list in python which has following entries name-1 name-2 name-3 name-4 name-1
I have a list view item which has a button and displays properties on
I have a list: Collection users which has around 100K+ records of users (all
I have a list of items of type ViewLookupItem which has these properties: For
I have a list of items ('sections') which has a getter and a setter.
I have a list of items, which has two values, a name and an
I have a list which contains dictionaries. Each dictionary has an attribute description which
I have a List<T> where T is my Event type which has a field

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.