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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:18:09+00:00 2026-05-13T11:18:09+00:00

What is a way to uniquely identify all DOM nodes in an HTML document.

  • 0

What is a way to uniquely identify all DOM nodes in an HTML document. To illustrate what I mean, here is a (fictional) example:

  • Script X randomly selects a DOM node from document.html.
  • Script X needs to tell script Y which DOM node it has chosen.
  • How does script X uniquely identify the DOM node it has chosen so that script Y knows exactly which node it is in document.html?

I’m really interested in how to uniquely identify the DOM node so that the script Y can identify it and manipulate it. Preferably, it should work with text nodes as well. I was thinking of XPath maybe, but I’m not sure how to generate a unique XPath to any given node.

  • 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-13T11:18:09+00:00Added an answer on May 13, 2026 at 11:18 am

    You should be able to determine a unique XPath by working backwards from the node to the root node, and tracking the node you’re on, and which sibling it is, such that you get something like:

    /a[1]/b[2]/c[101]/text()
    

    so that’s the 101st C node under the second B node, etc. As such, that’s a unique path and can be copied around with reference to the original document

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

Sidebar

Related Questions

Which way do you prefer to create your forms in MVC? <% Html.Form() {
The way you would normally include a script is with source eg: main.sh: #!/bin/bash
Typical way of creating a CSV string (pseudocode): Create a CSV container object (like
The way I do 80-column indication in Vim seems incorrect: set columns=80 . At
The way the iPhone uses the touchscreen to enable zooming in and out and
Efficient way to handle COM related errors in C++ . For instance: switch (HRESULT_CODE(hresult))
Whichever way I do it, it seems something goes wrong when using the conditional
What is a nice way to end an interview that is clearly going badly?
Is there a way to enforce constraint checking in MSSQL only when inserting new
Is there any way to check whether a file is locked without using a

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.