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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:58:10+00:00 2026-06-03T13:58:10+00:00

Is there a way to use one() with event delegation? like on() or live()

  • 0

Is there a way to use one() with event delegation? like on() or live() so that it will be applied to DOM elements that are not created at the binding time?

  • 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-03T13:58:13+00:00Added an answer on June 3, 2026 at 1:58 pm

    Yes. From the jQuery .one() docs:

    The second two forms, introduced in jQuery 1.7, are identical to .on() except that the handler is removed after the first time the event occurs at the delegated element, whether the selector matched anything or not. For example:

        $("#foo").one("click", function() {
          alert("This will be displayed only once.");
        });
        $("body").one("click", "#foo", function() {
          alert("This displays if #foo is the first thing clicked in the body.");
        });
    

    After the code is executed, a click on the element with ID foo will display the alert. Subsequent clicks will do nothing.

    This means that, when you use the form $(el).one('click', '.selector', handler) it will work like live — the event handler is bound to el (which has to exist in the DOM) but the event handler will only be executed on clicks on .selector, regardless of whether that element exists during your call to .one().

    Edit: It seems that jQuery’s documentation on this is wrong — at least, the way I interpret it. According to the alert above,

    “This displays if #foo is the first thing clicked in the body.”

    Which makes me think that if anything else is clicked in the body first, the event handler will be removed and won’t fire again. This is not the case — the event handler will exist until #foo is clicked one time.

    See this fiddle for a demonstration.

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

Sidebar

Related Questions

Is there any way to allow one form to use the event procedures from
Is there a way to use one CASE statement and return 2 different values?
Is there a way to use one of this preview controls with UISplitViewController's detail
Is there a way I can use one category to stylize all of my
is there a way to configure trac to use more than one svn repo
Are there any counterindications to fork under mod_perl2? Should one use another way to
Is there a way to use lapply() in a manner that forces it to
In JavaScript i used to use event delegation like this : someDiv.addEventListener('click', function(evt){ if(evt.target.id
Is there a way to create a custom attribute that will make EF CodeFirst
I found several solutions which use Post-Build event. Is there a way to publish

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.