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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:31:44+00:00 2026-05-13T16:31:44+00:00

In the program I’m writing I need to be able to access the node

  • 0

In the program I’m writing I need to be able to access the node that is sending an event in javascript.

I have been unsuccessful in using this, as it is referring to the object in my code. So the following doesn’t work.

var node = new node();

// Node Object
function node() {

// Create Sibling Node
this.createSibling = function() {
 var node = createNode();
 this.parentNode.appendChild(node); } }

When I call the function createNode() it assembles a link that has an event onclcick attached to it called node.createSibling() and node.createChild() on a different link.

I’m currently using var NODETREE as the parent because I’m don’t know how to get the node that is begin clicked. This is keeping me from being able to create node with their own children and siblings; only the main node can get them.

    var node = new node();

   // Node Object
   function node() {

   // Instance Veriables    
   var NODETREE = document.getElementById('node-tree');

   // Create Sibling Node
   this.createSibling = function() {
   var node = createNode();
   NODETREE.appendChild(node); } }

How do I access the node that has the onclcick event attached that is being clicked, without having to create a load of code, so I can create children and siblings for the nodes that I have created and not just the trunk?

NOTE:

I need to do this without jQuery or another framework.

  • 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-13T16:31:45+00:00Added an answer on May 13, 2026 at 4:31 pm

    When an element has an eventhandler the Event object is passed to the event handler. This event object has amongst other things a reference to the node that triggered the event.

    So…

    var createSibling = function(_event){
      var e = this; // the element this function is actually attached to
      var event_e = _event.target; //another way to get at the element clicked
    
      // do stuff
    };
    
    document.getElementById('myElement').onClick = createSibling;
    document.getElementById('myElement').captureEvents(Event.CLICK);
    

    The problem is the property names for different things differ cross browser – this is another reson to use a framework because they will implement the browser detection ans specific implementations which you will need to do if you do not use one.

    See quirksmode.org for some advanced details: http://www.quirksmode.org/js/introevents.html

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

Sidebar

Ask A Question

Stats

  • Questions 338k
  • Answers 338k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The item view type you are returning from getItemViewType() is… May 14, 2026 at 4:23 am
  • Editorial Team
    Editorial Team added an answer You use it the same way you'd use a template… May 14, 2026 at 4:23 am
  • Editorial Team
    Editorial Team added an answer Yes, just add the second bit as you mentioned: <link… May 14, 2026 at 4:23 am

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I created a program in C# .net using VS2008. When the user installs the
I am developing a medium size program in python spread across 5 modules. The
I'm having problem when running my Windows Forms program. In the program, I have
In a Java program I am currently getting Unhandled Exception at a certain point

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.