I have a div like this:
<div id="x" name="x" class="x" style=""></div>
and contained within this div I have several divs like this:
<div id="y_1" name="y_1" class="y" style=""></div>
<div id="y_2" name="y_2" class="y" style=""></div>
<div id="y_3" name="y_3" class="y" style=""></div>
etc.
QUESTION 1:
How do I detect how many of these divs (class=”y”) are contained within the container div (class=”x”)? – (just an alert(“”) with the number, for example).
QUESTION 2:
How do I do something to each of these y-divs (class=”y”) such as a function that might place the letter “Y” into all of the y-divs using $(‘.y’).html(“Y”); , for example??
Any help appreciated guys….
You need to find the elements within the ancestor element.
See the API:
lengthproperty