Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
How to get specific element inside of element stored in variable?

I am looking for way to select element inside of already located element in variable. For example I have selected a container:

let productAttachedFilesModal = document.getElementById('modal_more_information');

I know, that inside are array of a elements, which I want to select as well. Which method should I use? in jQuery there are method find(). So I need the analog for JS. Or I need to use DOM method again? Like this:

let listOfLinks= document.getElementById('modal_more_information > a');

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You can just query that stored DOM reference:

let productAttachedFilesModal = document.getElementById('modal_more_information');

// Query the stored DOM element for all descendent anchors
let childAnchors = productAttachedFilesModal.querySelectorAll("a");
about 4 years ago · Juan Pablo Isaza Report

0

You should use productAttachedFilesModal.children to get its children, which is the elements inside. It will get you an array of HTML elements.

about 4 years ago · Juan Pablo Isaza Report

0

There are several ways:

let anchors = productAttachedFilesModal.getElementsByTagName("a");

let anchors = document.querySelectorAll("#modal_more_information > a")

let anchors = productAttachedFilesModal.querySelectorAll("a");
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!