Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Get DIV Name by its ID
(1 viewing) (1) Guest
All your queries regarding JavaScript will be solved in this forum
  • Page:
  • 1
TOPIC:

Get DIV Name by its ID

Get DIV Name by its ID 10 months, 4 weeks ago #651

  • sandhya
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Karma: 0
Lets say I have one page with a div.

<div name="divParent" id="divID"></div>

How do I retrieve the name "divParent" if I want to search for it with the div's ID "divID" ?

Re: Get DIV Name by its ID 10 months, 4 weeks ago #658

  • kate
  • OFFLINE
  • Senior Boarder
  • Posts: 47
  • Karma: 0
The following javascript code may works

document.getElementById("divID").getAttribute("name");

Re: Get DIV Name by its ID 10 months, 4 weeks ago #659

  • sandhya
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Karma: 0
Thanks it works..
  • Page:
  • 1
Time to create page: 1.35 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download