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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:28:57+00:00 2026-05-26T07:28:57+00:00

I am having problem with jQuery, which I recently starting playing around with. I

  • 0

I am having problem with jQuery, which I recently starting playing around with. I will try to explain my situation as well as I can and try to add all relevant information.

What I want:
Two lists, one in its own tab. Each item in the list has two images which also act as buttons. When a button is pressed, an event occurs. The event would be adding element to the other list. For now, as a proof of concept, this event is an alert containing the id of the list item.

The problem:
The alert occurs at an increasing rate, each time the button is pressed. More precisely, after every time pressing the button, one more alert pops up than before. The first time, nothing happens. The next time one alert is shown. After that two sequential alerts are shown, etc.

It is not obvious to me why this happens. I would appreciate if someone can point out to me what I might be doing wrong.

HTML:

<div class="demo">
<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab 1</a></li>
        <li><a href="#tabs-2">Tab 2</a></li>
    </ul>

    <div id="tabs-1">
        <ul id="sortable11" class="todoList">
            <li id="6" class="todo">
                <div class="text">This is text (6)</div>
                <div class="actions">
                    <a href="#" class="edit">Edit</a>
                    <a href="#" class="delete">Delete</a>
                </div>
            </li>
        </ul>
    </div>

    <div id="tabs-2">
        <ul id="sortable22" class="todoList">
            <li class="ui-state-highlight">Item 1</li>
            <li class="ui-state-highlight">Item 2</li>
        </ul>
    </div>
</div>
</div>

CSS:

.todo .actions a.edit{
    background:url("../img/edit.png") no-repeat center center;
}

.todo .actions a.delete{
    background:url("../img/delete.png") no-repeat center center;
}

jQuery:

$('.todo a.edit').live('click',function(){
    $('#sortable11 > li').click(function(){
        var current_id = $(this).attr("id");
        alert(current_id);
    });
});
  • 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-26T07:28:58+00:00Added an answer on May 26, 2026 at 7:28 am

    You’re binding the click in other click handler and it’s plain wrong.

    Just bind it once and it will work fine:

    $('#sortable11 > li').live('click', function(){
        var current_id = $(this).attr("id");
        alert(current_id);
    });
    

    In jQuery, binding event handler is not overriding existing handlers, but is adding new handler to allow more flexible programming.

    You can remove the previously attached handlers, but I can’t see any reason to do that.

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

Sidebar

Related Questions

I am having a problem with the jQuery datepicker. My form has a add
I'm having this problem where a floating widget I'm designing, which contains the jQuery
I'm having a little problem with jQuery: I'm having .submit() defined on a form,
I am having problem getting my tooltip to work when using the jQuery load()
I am having a very specific problem in JQuery The code below is used
I am having a problem trying to use the prependTo() function in jQuery... for
I'm having a problem trying to format the output on the jQuery UI datepicker.
I am using the jQuery UI components but having some problems. If I try
I am having a problem while calling overloaded C# function through jquery post method.
I am having a problem with CakePHP 1.3. I'm using a jQuery plugin for

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.