The following should work fine:
If you this is an issue because you are creating elements with duplicate
names, it is allowed but considered bad practice. I would recommend
a counter of something similar so that all the "id" attributes are unique.
When you want to group elements together using an attribute, use "class"
"name" - keep ID unique and your life will be a lot easier.
That all said, if you want to dig out a specific element within a DIV, it
can be done but it is a little extra work. You would have to loop through
all the elements until you find the one with a matching ID. Having a
ID for each element is usually a much simpler way of handling things.
On Thu, Jun 9, 2011 at 2:35 PM, Hockchai Lim
Do anyone know how I can use js to get DOM element within a <div>. I
below but it does not work:
var myDiv = document.getElementById('myDiv');
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives