SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
May 30, 2008, 12:38 #1
- Join Date
- Nov 2001
- Location
- Colorado
- Posts
- 2,085
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
getElementById and then getElementById again?
var staticNote = document.getElementById(currLevel+"-"+currTab+"-"+noteId+"-display");
var getContentOnly = staticNote.getElementById('noteContentHolder');
Can you do the above? get and element by Id and then get another element by id within the first returned set?WordPress Plugins: Comment Info Tip
My Blogs: What a Savage | Search-This
Tools: Search Engine Decoder | PageRank Decoder
Podcast: Rand Fishkin | SitePoint Founders
-
May 30, 2008, 13:22 #2
- Join Date
- Feb 2008
- Posts
- 62
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:if (staticNote.hasChildNodes()) { var children = staticNote.childNodes; for (var i = 0; i < children.length; i++) { if (children[i].id == 'noteContentHolder') { } } }
-
May 30, 2008, 13:26 #3
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
getElementById is a method of the document object only, so no you can't do that.
Since IDs must be unique per document, you should be able to do:
var staticNote = document.getElementById(currLevel+"-"+currTab+"-"+noteId+"-display");
var getContentOnly = document.getElementById('noteContentHolder');
Bookmarks