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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:56:41+00:00 2026-05-23T18:56:41+00:00

On my site, I have elements with event listeners (.live, .bind, or .delegate) and

  • 0

On my site, I have elements with “event listeners” (.live, .bind, or .delegate) and I can divide these into groups based on how often they appear:

  1. Elements that are on every page.
  2. Elements that are on some pages.

If I have an element that is on every page, and that element requires a listener, then of course I just implement that listener site-wide.

I’m trying to figure out what that will be wisest for an element that both (a) appears only on a few pages, and (b) requires a listener:

  • Implement the listener site-wide
  • Implement the listener so that it must first be initialized on any page that wants to use it

For example, say I have
<input class='autocomplete' /> that appears on several pages, but not site-wide. When someone enters text, it hits the database and tries to complete their query for them.

Since this element doesn’t appear on every page, is the overhead of jQuery.live('someEventsHere',MyHandler()) high enough that I should only call it on pages where it is used? (E.g., by creating an initializeMyHandler() function and calling it on those pages?) Or, on pages where that listener will not be used, is this cheap enough to set anyway and not worry?

  • 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-23T18:56:42+00:00Added an answer on May 23, 2026 at 6:56 pm

    live() works by attaching your event handler to the document, not to the element. Thus, live() makes use of event bubbling, so attaching event handlers won’t incur that much overhead, though there will admittedly be some. The HTTP request for the inclusion of a JavaScript file is more than the overhead incurred from attaching an unused event handler to the document.

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

Sidebar

Related Questions

my site has three div elements, header, content and footer. i have a picture
In my live site I have php include() and require() that have full path
I have a master page, with these lines in the on load event: string
I'm trying to add event rich snippets to my site so that Google can
I have a feature for a site APC and it has event handlers for
I have a site in rails and want to have site-wide settings. One part
So I have site list on certain pages that basically just have links to
On my site I have mod_rewrite rules to make the URLs more search engine
In an oscommerce site I have the following: Server response = Content-type: text/html;charset=UTF-8 and
On my web site I have XMLs with my page contents (automatically generated from

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.