PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 15, 2022

[FIXED] How to find the 'parent' of 'this' Node?

 October 15, 2022     dom, dom-events, javascript     No comments   

Issue

When targeting the current node, you can do event="function(this)" to tell the function you are dealing with this node. How can you get the node that the current element is in?

<div>
    <span event="function(this)">Click here</span>
</div>

I want to deal with the div, not the span. The current code deals with the span.


Solution

Each DOM Node has a parentNode property for that.



Answered By - Bergi
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing