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

  • Home
  • SEARCH
  • 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 6015143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:47:36+00:00 2026-05-23T02:47:36+00:00

I have some inputs with OnBlur event handlers something like <input name=abc tabIndex=5 class=datetime

  • 0

I have some inputs with OnBlur event handlers something like

<input name="abc" tabIndex="5" class="datetime" onblur="if (CheckMode(this))__doPostBack('abc',''); else return false;"  />

In JQuery Form ready, I’d like to convert OnBlur event hanlder into something like

 <input name="abc" tabIndex="5" class="datetime" onblur="....; setTimeout(function(){if (CheckMode(this))__doPostBack('abc',''); else return false;},100);"  />

It means I’d like to wrap the current event handlers with some extra codes.
I’d like to call the old code with setTimeOut() after doing some extra work.

If’s possible to do on the client side like the above?
I’ve tried attr() , but it does NOT work.

The contents are changed , but nothing happens onBlur.
Also, I think , I can’t use Blur()/Live()/bind() in this situation, can I?

  • 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-23T02:47:37+00:00Added an answer on May 23, 2026 at 2:47 am

    What you have there is called a DOM0 handler — a handler hooked up using a mechanism that isn’t defined by any DOM standard, but which is supported by all major browsers.

    In your particular example, you could just attach your own blur handler using jQuery which attaches a modern or “DOM2” handler, which won’t displace the DOM0 handler, since all you want to do is add a setTimeout call. If you wanted to do anything else, you’d have to do something more complicated, because some browsers call DOM0 handlers before calling DOM2 handlers, and other browsers call DOM2 handlers before calling DOM0 handlers. But again, since what you’re doing is triggering something asynchronous (via setTimeout), that wouldn’t matter, you don’t care which gets called first because your timeout code won’t run until later anyway.

    But let’s assume you want to do something more interesting:

    You can replace a DOM0 handler with a modern DOM2 one. You just have to grab the DOM0 handler from the reflected property on the DOM element, attach your own handler instead, and then call the DOM0 function from your handler. You want to be sure to call the DOM0 handler in the context it expects, and with the arguments it expects. Something like this (this example uses click rather than blur, but it should work the same in both cases):

    var target, dom0handler;
    
    // Use jQuery to find the element
    target = $("#target");
    
    // Did we find it?
    if (target[0]) {
      // Yes, get the DOM0 handler from the DOM element itself (not the jQuery object)
      dom0handler = target[0].onclick;
    
      // Get rid of it
      target[0].onclick = "";
    
      // Hook up our own handler
      target.click(function(event) {
        display("Before calling DOM0 handler");
        if (typeof dom0handler === "function") {
          if (dom0handler.call(this, event) === false) {
            event.preventDefault();
          }
        }
        display("After calling DOM0 handler");
      });
    }
    

    Live example

    Note the asymmetry: We read the onclick property and get a function, but we assign a string to it. Assigning a blank string to onclick is the most broadly-compatible way of clearing the handler (assigning null or undefined doesn’t work in some browsers). (Well, okay, the other way would be target[0].onclick = function() { }, but why create a function when you don’t need to.)


    Update:

    From your comment below, you’ve said you want to call the DOM0 handler after a timeout. You can do that easily enough just by wrapping the code to call it in a closure (and handling the this issue):

    var target,
        dom0handler,
        activeTimeout = 0; // Use 0 for "none" because 0 is not a valid return from `setTimeout`
    
    // Use jQuery to find the element
    target = $("#target");
    
    // Did we find it?
    if (target[0]) {
      // Yes, get the DOM0 handler from the DOM element itself (not the jQuery object)
      dom0handler = target[0].onclick;
    
      // Get rid of it
      target[0].onclick = "";
    
      // Hook up our own handler
      target.click(function(event) {
        var element = this; // Remember the element to a local, because `this` will have a different value inside the function called by `setTimeout`
        // If we have a function to call and we're not busy...
        if (activeTimeout === 0 && typeof dom0handler === "function") {
          // ...call it
          activeTimeout = setTimeout(function() {
              activeTimeout = 0;                // Clear this since the timeout has occurred
              dom0handler.call(element, event); // Call the handler; we no longer care about its return value
          }, 100);
        }
        return false;
      });
    }
    

    And to cancel it before it happens:

    if (activeTimeout !== 0) {
        clearTimeout(activeTimeout);
        activeTimeout = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some checkbox inputs like so: <input type=checkbox name=1 class=filter/> <input type=checkbox name=2
I have some hidden inputs like this <input name=exam.normals[1].blahblah ..../> I would like somehow
If I have some hidden inputs in my form: <input type=hidden name=test value=somedata> <input
I'd like to have some hidden inputs on View A.aspx and pass the values
I have some input like this: aaaaa bbb \n cccccc\n ddddd \neeee And I
I have some dynamically created inputs which are not server-side controls. I want to
We have some input data that sometimes appears with &nbsp characters on the end.
I have some input fields in a page and i want to validate if
i have one form which have some input box and some select box. i
I have some bison grammar: input: /* empty */ | input command ; command:

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.