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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:14:32+00:00 2026-05-15T13:14:32+00:00

So on a specific page I have some number of form elements, anywhere between

  • 0

So on a specific page I have some number of form elements, anywhere between 3 and 8, depending upon the user and their action on the page.

How can I add a specific onblur event to all of the form elements dynamically on the page?

If I have:

function doThisOnBlur() { stuff }

How can I add that same function to all of these once the page loads. No elements are created after the page loads but different elements may appear for different users.

<input type="text" id="x">
<input type="text" id="y">
<select id="z">...</select>

Is that possible?

  • 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-15T13:14:33+00:00Added an answer on May 15, 2026 at 1:14 pm

    Edit: For updated question
    Use .blur() and an anonymous function for this (doesn’t matter how many elements there are):

    $(":input").blur(function() {
      //do stuff
    });
    

    If you need to bind certain functions to certain fields, use classes or an attribute selector on name, anything to distinguish them…if the selector doesn’t find an element it simply won’t bind an event handler to anything. That way, the same overall code works for all users, even if they only see some of the form elements available.


    For original question: if elements were dynamically added after page-load.
    I think .live() to capture the blur event is what you’re after here, using :input as the selector:

    $(":input").live('blur', function() {
      //do stuff
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some script in my default page that redirects users to language specific
I have a wordpress-generated page where I need some posts (in a specific category)
What we need: redirect to each user's specific page after their login. What we
Ok, so this question probably isn't Silverlight specific. I have a silverlight 2 page
I have some images from another source that need to refresh from their offsite
I have a specific case here in which I would like some security advice.
I have a table with number of page views per day. Something like this:
We have a hosted application that manages pages of content. Each page can have
I have a main div in my page with a specific id . Now
I have some javascript that gets the browser name and version number of 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.