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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:13:04+00:00 2026-06-12T06:13:04+00:00

How can I create a completely separate and new event object that contains all

  • 0

How can I create a completely separate and new event object that contains all of the same exact properties as a given event object e. So far I’ve tried the following but no luck:

function myHandler(e) {
   // ...

   e = e.originalEvent;

   // method 1
   var e2 = jQuery.extend(true, {}, e);

   // method 2
   var e2 = JSON.parse(JSON.stringify(e));

   // ...
}

EDIT: I will add more details to help clarify. Very similar to this question I am trying to do: div.dispatchEvent(e.originalEvent), but doing so results in:

DISPATCH_REQUEST_ERR: DISPATCH_REQUEST_ERR: DOM Events Exception 1

so in order to avoid this, I need to duplicate the event object. However, this event object isn’t a specific one (i.e., sometimes the e is a touchstart, touchmove, or touchend) and therefore it’d be easier if I could get a general cloning function instead of just hard coding the specific properties. What I meant by "no luck" was that by trying the aforementioned methods and sending that thru the dispatch function I was getting errors. Hope this helps clarify a bit.

  • 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-12T06:13:05+00:00Added an answer on June 12, 2026 at 6:13 am

    I’ve had “good luck” with this code:

    $.extend($.Event(event.type /* click, mousedown, touchstart, ect. ect. */), {
        which: 1,
        clientX: event.clientX,
        clientY: event.clientY,
        pageX: event.pageX,
        pageY: event.pageY,
        screenX: event.screenX,
        screenY: event.screenY
    });
    

    Obviously, this is everything; but you can add what you actually need in the other object. I create a new event here, because I’m actually forwarding an event to another element.


    Update:

    I use jQuery Touch Punch Plugin which basically maps click/mouse events to the associated touch event: touchstart, touchesmoved, touchend. So if you forward this event as the mouse event:

    var newEvent = $.extend($.Event(event.type), {
        which: 1,
        clientX: event.clientX,
        clientY: event.clientY,
        pageX: event.pageX,
        pageY: event.pageY,
        screenX: event.screenX,
        screenY: event.screenY
    });
    
    // touch punch will convert to a touch event if needed
    $('.some-other-element').trigger(newEvent); 
    

    You simply need to include the touch punch script on your page. This will also allow jQuery UI elements to function on touch devices.

    references:

    • jQuery Event Constructor
    • jQuery trigger
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I create a completely new column with the same value for each
Does anyone know how I can create a Completely transparent image or given am
I can create a contact that is not mail enabled, but how do I
If I declare an object as follows: var foo.bar = new Object; Does that
I have a plugin that creates an object that has an event. Is there
I'm trying to create a new picture record within my gallery. Users can create
Here is my complete script... You can just create test.php and throw it in.
i want to create a webpage on iphone , but i can't complete it
I can create and use dynamic two dimensional array in Fortran (in 77 standard).
You can create a table model and add it to a table TableModel tm

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.