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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:17:45+00:00 2026-06-04T05:17:45+00:00

I have this jsbin ( prev answers didn’t help much) <span id=mySpan > click

  • 0

I have this jsbin ( prev answers didn’t help much)

 

<span id="mySpan" > click here </span>
  <br/> 
  <input id="myCb" type="checkbox"/>

enter image description here

i have a listener for checkbox click which do Alert…

However , clicking on the span is triggering the click event for the checkbox.

I want to detect – who really made the checkBox execute the alert.

But !

I want :
if first clicked the span , alert
i was originally pressed by mySpan

else

if first clicked the checkbox , alert i was originally pressed by myCb

$("#mySpan").on('click',function (e) 
  {
    $("#myCb").trigger('click');

  });

$("#myCb").on('click',function (e) 
  {
    doWork(e)
  });


function doWork(e)
{
  alert('i was originally pressed by '+$(e.delegateTarget).attr('id') );
 }

p.s. i can use a global field or flag solution – which i DONT WANT.

i will be glad to have a “moving the data” through the e param – solution.

thanks.:)

edit

jQuery does support moving data , but i cant write the right code

enter image description here

  • 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-04T05:17:46+00:00Added an answer on June 4, 2026 at 5:17 am

    how about this.

    $("#mySpan").on('click',function (e) 
      {
    
        $("#myCb").trigger(e);
    
      });
    
    $("#myCb").on('click',function (e) 
      {
        doWork(e);
      });
    
    
    function doWork(e)
    {
      alert('i was originally pressed by '+$(e.target).attr('id') );
     }
    

    It worked for me and it was the closest to your original code.

    in action http://jsbin.com/ixanup/2/edit#javascript,html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
I have this example http://jsbin.com/ipasu3/4/ When you click on a div code it hides
I have this function (sample here: http://jsbin.com/emabe4/ ) var a=[]; var log = document.getElementById('log');
I have set up a demo here: http://jsbin.com/evifeb/ This is more of me thinking
Check out this jsbin . I have a form with a custom button that
check this page out: http://jsbin.com/itufix with IE (page automatically enables IE7 mode). Here you'll
I have code 1 which executes with this in the head: <link class=jsbin href=http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css
I have a bunch of elements like this: <div></div> <span></span> <table></table> <div></div> <span></span> <div></div>
Hi i have this script http://jsbin.com/ajaneh , when i make an action throw ajax
I have this script: JsBin It allows to display the corresponding favicon to a

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.