Hi friends,

I've just discovering jQuery and it's a great library.

My Javascript's knowledge is not so good than I wish, I'm a newby in
this world.

I've problems to select a certain element on code HTML generated by
php. Following tutorials, api's and rest of very good docs I can't
resolve this problem.

,----[ HTML Code ]
| <div class="box-general">
|      <div class="box-articles">
|           [...]
|           {Article options linked with <a> or <img> tags}
|           [...]
|           <img class="box-slide" id="article-id">
|           [...]
|           <div class="box-slide-hidden" id="article-id">
|                <div class="article-slide">
|                     {Info about article selected}
|                </div>
|           </div>
|      </div>
| </div>
`----

,----[ CSS Code ]
| [...]
| .box-slide-hidden {
|     display:none
| }
| [...]
`----

,----[ jQuery Code ]
| $("img.box-slide").click(function() {
|      // Get unique id;
|      var $match-img-id = $(this).attr('id');
|
|      $(div.box-slide-hidden).each(function (i){
|          // Get unique id to compare with $match-img-id
|          // and, if true, run slide effect.
|          var $match-div-id = $(this).eq(i).attr('id')
|          [...]
|      });
| });
`----

This code works but only shows the first div.box-slide-hidden
occurrence. Something was wrong in, each loop, that don't iterate rest
of html code generated.

I've proved with next(), filter(), finder() and rest of selectors
functions in order to get right element but I'm not able to do
it.

There's one solution to this problem, change div.box-slide-hidden
position, putting it just after img tag and, with next(), accessing to
next element, in this case, searched element. If I apply this method,
obviously, all html code elements (img, a, and rest of tags from img
clicked to final of design) was changed, moved down and disaster.

How can I get a right loop to show right reference only?

Greetings.
--
Julio AntĂșnez TarĂ­n
jat en escomposlinux punto org

Reply via email to