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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:51:38+00:00 2026-05-28T22:51:38+00:00

I have multiple elements with the same class clickable, i’m binding all these classes

  • 0

I have multiple elements with the same class “clickable”, i’m binding all these classes with:

 $('.clickable').bind('click', function()
     { 
       $(this.id).html('clicked');

     }

I’m assuming the bind binds each element with the class “clickable” individually.
Then within this bind-function, I want to unbind the currently clicked element with:

 $(this.id).unbind('click');

So that if you click again within this element, it doesn’t trigger the click-function again.
And then, after doing stuff within the element (replace the text withing these elements with an that puts the current text in it, and when you click outside it it wil alter the html for it) I want to rebind the click again, but I cant’t seem to unbind the click for this.id…

Some fiddle for clarification:
http://jsfiddle.net/TrySpace/QZMP6/7/

  • 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-28T22:51:39+00:00Added an answer on May 28, 2026 at 10:51 pm

    Probably because your selector is wrong (because your selector would translate to something like $("my_id") when you really want $("#my_id")). In this case, you could just do:

    $(this).unbind('click');
    

    Which is ultimately better than querying the DOM again for an element.

    Side note: bind and unbind are deprecated as of jQuery 1.7. The updated way to write this is with on and off:

    $(".clickable").on("click", function () {
        /* ... */
        $(this).off("click");
    });
    

    Edit (per comments below):

    If you want to prevent parent event handlers from being notified as well, you could bind a new handler that prevents propagation of the event:

    $(this).off("click").on("click", function (e) {
        e.stopPropagation();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple div elements with same id='mydiv'.I want to calculate these divs and
I have a webpage with multiple DIV elements. If i use the jquery function
Is it ok to have multiple dom elements with the same id on a
I'm looking for an HTML/CSS solution to this challenge: I have multiple elements with
I have a script (helped out by @briguy37 Remove multiple elements with same name
I have multiple table in which i'm showing comments. Each table have same elements.
I have a form with elements like: <div class=row1> <select name=someSelectField multiple=multiple class=selectList> <option
I have multiple ajax forms on page that cointain same elemets, I have jquery
I have a XmlString which contains multiple elements with their nodes. ie <Element> <AccountName>My
I have source XMLfiles that come in with multiple root elements and there is

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.