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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:49:48+00:00 2026-05-14T19:49:48+00:00

I have a Javascript question that I am curious about. When using: var test

  • 0

I have a Javascript question that I am curious about. When using:

var test = document.links(arrayNum).name;

Is it possible to dig deeper into specifying links? For instance, if there is just a group of links from within a div with an id that you would like to target as opposed to all the links on the page could you write something like:

var test = document.getElementById('divId').links(arrayNum).name;

Or could I add a class to the statement to target only the links associated with it?

var test = document.links.className(arrayNum).name;

Is anything like this feasible?

  • 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-14T19:49:49+00:00Added an answer on May 14, 2026 at 7:49 pm

    The links collection belongs to the document object only, it is not on the prototype chain for elements. It’s not quite the same thing, but you can get all the <a> tags of a particular element using getElementsByTagName:

    // retrieve a collection of all a elements
    var test = document.getElementById('divId').getElementsByTagName("a");
    

    In browsers that support it, you can use querySelectorAll:

    // retrieve a collection of all links
    var test = document.getElementById('divId').querySelectorAll("a, area");
    

    Or you could use a library like jQuery or mootools to do all the hard work for you:

    var test = $("#divId a, #divId area");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Javascript code that does this: var oObjchbox = document.getElementById(CheckBox_ + countyId); The
I'm a bit of a javascript noob, but I have a general question that
I'm studying javascript these days and I have question. I have variable that contain
I have javascript string variable with var sttr=We prefer questions that can be answered
I am making a webapp. I have a fairly basic question about javascript performance.
i have a question to deserialize JSON text to an javascript object, i test
Good Morning All, I have an Objective C question that is coming from JavaScript.
I have been quite curious about how javascript reacts to errors(like ReferenceError, for example).
I have what is I believe an extremely basic javascript question that for some
I have a javascript question. I'm trying to dynamically build a plugins string variable

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.