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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:37:13+00:00 2026-06-18T10:37:13+00:00

I have a function called applyToDetailRows, which I call on load, as well as

  • 0

I have a function called applyToDetailRows, which I call on load, as well as when the input section of my page gets re-drawn via ajax. this function, attaches a bunch of events to the input fields that get drawn. One of the events on a field is blur, which triggers an ajax call to fetch student info. The problem is that the blur ajax trigger fires every time the page loads for each field, rather than firing on blur. And this only happens if the function is defined inside of applyToDetailRows. If I pull it out of applyToDetailRows, it works fine.

one thing to note is that I also have auto-complete defined in applyToDetailRows in the similar manner, and it works fine. But not this.

    function applyToDetailRows() {
        $(":input[data-getstudent]").each(function() {
            $(this).on('blur', function () {
                var elem = this;
                $.ajax({
                    url: $(elem).attr('data-getstudent'),
                    dataType: "json",
                    data: {
                        studentNumber: $(elem).val()
                    },
                    success: function (result) {
                    }
                });
            });
        });
    }

/* some other definitions */

//applyToDetailRows called

applyToDetailRows();
  • 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-18T10:37:15+00:00Added an answer on June 18, 2026 at 10:37 am

    You would prefer to use event delegation instead of re-applying the function after each request since it is possible you may be binding it wrong or more than once.

    $(document).on("blur", ":input[data-getstudent]", function(){
      /* AJAX */
    });
    

    You can replace document with a common parent of all the input elements that is closer in the DOM tree to them than it.

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

Sidebar

Related Questions

I am using jQuery(Latest release) and have a function called calculate() which gets called
I have a function called GetIP which I call on startup and when the
I have function called buildRay which returns a 1x4 matrix. I call it multiple
I have a function called go() which needs to be called thrice on page
I have a function called on every single page: /// <summary> /// Gets the
I have a function called call facebook. call_facebook(284328420994); call_facebook(197214710347172); It runs severaltimes It makes
I have a function called PreProcessSource, which allocates a boost::wave::context and does some preprocessing;
Now I'm sure this is super easy, I have a function called remove_deposit which
I have a function called UpdateBoatTable, which is supposted to update a HTML Template
I have a function called bodyStyle() which accepts 5 values: bodyStyle(textCol, backCol, heading1Col, headingsCol,

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.