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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:59:28+00:00 2026-05-29T09:59:28+00:00

Is $(*).click(function(){…}) considered expensive? – See here . How about sending an ajax request

  • 0

Is $("*").click(function(){...}) considered expensive? – See here.

How about sending an ajax request on every click?

Will it cause a noticeable (perf?) problem for normal users? The app is not a game where you need to rapidly click stuff … just a normal web app. Clicks are, I would imagine, relatively rare.

Take Stack Overflow as an example site – if this was done on SO, would it be expensive?

Note – from the linked question, I get the notiion that $("*").click() would have horrible perf on its own, at least on some browsers. Is there a better technique to still do what I want (send an ajax request on every click), without being a perf hog? Is live() the answer?

Note – I’m focusing on the client, because I am not expecting a tremendous number of concurrent users. I believe the server can handle it.

  • 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-29T09:59:28+00:00Added an answer on May 29, 2026 at 9:59 am

    If you want to catch clicks everywhere, you should use the delegate method instead of binding all elements:

    $('body').delegate('*', 'click', function(){ ... });
    

    This will bind a single event handler on the body element and handle events when they bubble up from the elements that are clicked on.

    Sending an AJAX request on every click would not affect the browser much, but it might be heavy on the server if you have a lot of users. Also, if someone clicks several times in a row, the requests would queue up on the server, and it would take a while for all the responses to get back to the browser.

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

Sidebar

Related Questions

$('.ajax').click ( function() { // If been bound then we need to return here.
$('#selector').click(function() { // here I would like to load a javascript file // let's
$('input[name=iplus]').click(function() { $(#billsumary).append(<li>Test</li>); }); I append a li-elemnt on every click. Now I would
function exporttoexcel() { $('#export').click(function() { $.ajax({ url: 'exportdata.aspx', cache: false, success: function(data) { }
$(function() { $(table.section thead).click(function() { if ($(this).next(table.section tbody).style.display == block){ $(this).next(table.section tbody).slideUp(slow); } if
When using $('.foo').click(function(){ alert(I haz class alertz!); return false; }); in application.js, and <a
$('input[type=checkbox]').unbind().click(function(e){ $(this).attr('checked', true) return false; }); I NEED to return false because I have
Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
$(#tab1).click(function(){ loadTab(1); $('div.HOMEtabdiv ul.HOMEtabs a').removeClass('selected'); $(this).addClass('selected'); }); Would it be possible to make the

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.