Hola:
Tengo el siguiente marcado HTML:
Código:
<div class="span7 offset1 wall-post">
<div class="span1" style="text-align: right"><img src="http://www.gravatar.com/avatar/7b7690d4de079ea9f3c51eac3b06d95d?s=50&r=g" alt="Gravatar" class="gravatar" /></div>
<div class="span5">sdfsdf</div>
<div class="clearfix"></div>
<div class="span6 wall-links" style="text-align: right">
Writed by: ReynierPM, 31 minutes ago - <i class="icon-edit"></i> <a href="#" class="comment-link0">Comment</a> </div>
<div class="clearfix"></div>
<div class="comment-box_0 span5 offset-1" style="display: none">
<hr>
<div class="span3 input-append">
<input type="hidden" name="p_id_0" id="p_id_0" value="6" />
<textarea id="comments_0" name="comments_0" placeholder="Comments" class="input-xlarge comments_6"></textarea>
<button type="button" class="btn btn-inverse" id="send_comment">Comment</button>
</div>
</div>
</div>
<div class="span7 offset1 wall-post">
<div class="span1" style="text-align: right"><img src="http://www.gravatar.com/avatar/7b7690d4de079ea9f3c51eac3b06d95d?s=50&r=g" alt="Gravatar" class="gravatar" /></div>
<div class="span5">asdasdad</div>
<div class="clearfix"></div>
<div class="span6 wall-links" style="text-align: right">
Writed by: ReynierPM, 32 minutes ago - <i class="icon-edit"></i> <a href="#" class="comment-link0">Comment</a> </div>
<div class="clearfix"></div>
<div class="comment-box_0 span5 offset-1" style="display: none">
<hr>
<div class="span3 input-append">
<input type="hidden" name="p_id_0" id="p_id_0" value="5" />
<textarea id="comments_0" name="comments_0" placeholder="Comments" class="input-xlarge comments_5"></textarea>
<button type="button" class="btn btn-inverse" id="send_comment">Comment</button>
</div>
</div>
</div>
<div class="span7 offset1 wall-post">
<div class="span1" style="text-align: right"><img src="http://www.gravatar.com/avatar/7b7690d4de079ea9f3c51eac3b06d95d?s=50&r=g" alt="Gravatar" class="gravatar" /></div>
<div class="span5">asdasd</div>
<div class="clearfix"></div>
<div class="span6 wall-links" style="text-align: right">
Writed by: ReynierPM, 32 minutes ago - <i class="icon-edit"></i> <a href="#" class="comment-link0">Comment</a> </div>
<div class="clearfix"></div>
<div class="comment-box_0 span5 offset-1" style="display: none">
<hr>
<div class="span3 input-append">
<input type="hidden" name="p_id_0" id="p_id_0" value="4" />
<textarea id="comments_0" name="comments_0" placeholder="Comments" class="input-xlarge comments_4"></textarea>
<button type="button" class="btn btn-inverse" id="send_comment">Comment</button>
</div>
</div>
</div>
Y este codigo jQuery que deberia permitirme mostrar cada uno de los DIV de forma independiente cuando se haga click sobre el enlace apropiado:
Código PHP:
var i = 0;
$(".wall-post a").each(function(i){
$(".comment-link" + i).click(function(){
$(".comment-box_" + i).slideToggle();
});
i++;
});
No deberia funcionar? Q estoy haciendo mal?