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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:29:19+00:00 2026-05-17T17:29:19+00:00

I have a couple of span elements inside a HTML hyperlink like this. <a

  • 0

I have a couple of span elements inside a HTML hyperlink like this.

<a href="Default.aspx"><span id="span1" onclick="adddata();">Span1<asp:Literal ID="Lblcount" runat="server"></asp:Literal></span><span id="span2" class="removetab ui-icon ui-icon-circle-close" style="float:right; margin: -2px -10px 0px 3px; cursor:pointer;" onclick="removedata();"></span></a>

At the moment upon clicking ‘span1’ I am executing a js function ‘adddata’ which invokes a serverside webmethod and upon clicking ‘span2’ I am executing ‘removedata’ js function which again invokes a different server side webmethod.

My requirement is that I need to call the ‘adddata’ js function on hyperlink click as well in addition to ‘span1’ click but not on ‘span2’ click.I tried calling the ‘adddata’ function on hyperlink onclick event instead of the ‘span1’ onclick event but that is causing the function to be called on ‘span2’ click as well.

I do not understand how do I execute the same function on hyperlink and span1 click and a different function on span2 click.

Could someone please help?

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-17T17:29:19+00:00Added an answer on May 17, 2026 at 5:29 pm

    In your span2 cancel the event bubble, change this:

    onclick="removedata();"
    

    To this:

    onclick="removedata(); return false;"
    

    This prevents a click event in the <span> from bubbling up to the <a> element and triggering it’s onclick handler as well.

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

Sidebar

Related Questions

We have a couple of applications running on Java 5 and would like now
I have searched and found a couple of solutions on this site, that didn't
I have a div wrapped around a couple span 's and using JS to
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
I have a html table and I am trying to have it span the
I have an SQL Table named samples, defined like this: sampledate (datetime, 24 records
All, I have couple of queries with respect to displaying html: I have a
I'll have couple of python functions I must interface with from the assembly code.
I have a couple of questions regarding VBScript and ASP Classic: What is the
I have a couple of files containing a value in each line. EDIT :

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.