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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:37:08+00:00 2026-05-30T17:37:08+00:00

I am assigning an event handler function to an element through the native browser

  • 0

I am assigning an event handler function to an element through the native browser onclick property:

document.getElementById('elmtid').onclick = function(event) { anotherFunction(event) };

When I’m in anotherFunction(event), I want to be able to use the event object like I would with the event object you get in jQuery through the .on() method. I want to do this because the jQuery event object has properties and methods such as .pageX, .pageY and .stopPropagation() that work across all browsers.

So my question is, after I’ve passed in the native browser event object into anotherFunction(), how can I turn it into a jQuery event? I tried $(event), but it didn’t work.

The obvious question here is: why don’t you just use jQuery .on, .bind, .click etc to assign your event handling functions? The answer: I’m building a page that has a huge table with lots of clickable things on it. Unfortunately this project requires that the page MUST render quickly in IE6 and IE7. Using .on et al in IE6 and IE7 creates DOM leaks and eats up memory very quickly (test for yourself with Drip: http://outofhanwell.com/ieleak/index.php?title=Main_Page). Setting onclick behavior via .onclick is the only option I have to render quickly in IE6 and IE7.

  • 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-30T17:37:09+00:00Added an answer on May 30, 2026 at 5:37 pm

    Too long for a comment… Because the documentation is a bit vague on this… (I’m looking at 1.7.1 in the following)

    jQuery.Event(event, props):

    • creates a new object
    • sets its type property to the event’s type property.
    • sets isDefaultPrevented by normalized calls to all the ways to check if default is prevented.
    • sets originalEvent to reference the event you passed in.
    • adds an arbitrary set of properties provided by the props object argument.
    • sets a timestamp.
    • marks object “fixed”.

    What you get is basically a new object with a few additional properties and a reference to the original event – no normalization other than isDefaultPrevented.

    jQuery.event.fix(event):

    • ignores objects that have already been marked “fixed”.
    • makes a writable copy (by way of jQuery.Event()) and normalizes the properties mentioned here.

    ETA:

    Actually, looking closer at the code, jQuery.event.fix() should work – in the way described by @Beetroot-Beetroot. It’s all that jQuery does to create the jQuery event object in an event dispatch.

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

Sidebar

Related Questions

Let's say I want to pass some extra data when assigning an event handler.
If I am assigning an event handler at runtime and it is in a
How does jquery handle event assignment when it comes to assigning the same handler
I'm having problem assigning an event handler a contextmenu menuitem which is bound as
have you ever found a problem when assigning a click event handler for your
I need to loop through Components and assign an event handler (for example Dynamically
I'm assigning an onclick handler to a checkbox. Sometimes javascript that does the binding
can someone tell me what the difference between assigning event handlers using bind(): $(function
Need some help assigning a mouseover event to display some icons that start out
I have a problem when assigning functions to the click event of a button

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.