I'm making a grid-layout type of drag and drop table just to learn some more javascript (especially script.aculo.us with Protocol).
Heres a quick example of one of my icons (I use PHP variables for the data):
Code:
<div class="folder" id="tile_folder_$i">
<img class="icon" src="$icon" />
<input type="hidden" name="path" value="$path" />
<a class="name" href="$url">$name</a>
<span class="size">$fcount</span>
</div>
I want to access the hidden value with javascript by only being given the main div's ID. Ex: this.child("path").value // With "path" being name/id/class, it does not matter.
I tried using childElements() ($(id).childElements()[1]).value;, but that will complicate things later if I decide to change the layout of the tiles. I also tried many ways using Prototype's $$ symbol which lets you access elements via css format. However, the way my object is set up I only have access to the element itself (not the ID).
|