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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:39:41+00:00 2026-06-03T02:39:41+00:00

Why does .parent of an item in .getElementsByTagName return undefined? I am trying to

  • 0

Why does .parent of an item in .getElementsByTagName return undefined? I am trying to apply a class to the parent of the with href equal to document.URL.

<div id="JSE_vertical_nav">
  <div class="jse_link_row">
    <a href="../SitePages/Home.aspx">HOME</a>
  </div>
  <div class="jse_link_row">
    <a href="#">ABOUT</a>
  </div>
  <div class="jse_link_row">
     <a href="#">NEWS</a>
  </div>
</div>

<script language="javascript" type="text/javascript">
  var jse_page_url = document.URL;

  var jse_links_in_nav = document.getElementById('JSE_vertical_nav').getElementsByTagName('a');
  for (var i=0; i < jse_links_in_nav.length; i++) {
    if (jse_links_in_nav[i] == jse_page_url) {
      //why does this alert undefined?
      alert(jse_links_in_nav[i].parent);
    }
  }
</script> 
  • 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-03T02:39:42+00:00Added an answer on June 3, 2026 at 2:39 am

    parentNode is the property you’re looking for 🙂

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

Sidebar

Related Questions

i have code, which does something like this: item.previous.parent.parent.aTag['href'] now i would like to
I have the following jQuery function: function GetGrandparentDiv(item) { return item.parents('div:eq(1)'); } Which is
Why does this code: var jQueryString=div.data > div.item > div.quantity,div.article,div.price > :input; $(jQueryString).live(click, function(event)
Does anyone know how to add an item to a list but do it
I have a WxPython frame containing a single item, such as: class Panel(wx.Panel): def
Scenario: I have the following structure; Group (parent) -> Item (child). A Group can
I am trying to access values from a user control MVVM in a parent
I'm trying to have text spans pop up on a hover pseudo-class for different
How do you remove an item from a jQuery Accordion? I am trying to
I am trying to make a phone call on a list item click. Here

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.