It's Work
On 27 ago, 16:41, James <james.gp....@gmail.com> wrote:
> You have to loop through the jQuery set. You can use the each() method
> for that.
>
> $(document).ready(function(){
> $(".img").each(function() {
> var url = this.href;
> $("#imgbox").append('<img src="+url+" />');
> });
>
> });
>
> On Aug 26, 4:06 pm, Jottae <smallj...@gmail.com> wrote:
>
> > Hi guys
> > I'm trying to do the following:
>
> > -----------------------------------------
> > $(document).ready(function(){
> > img=$(".img");
> > imga=img.attr("href");
> > $("#imgbox").append("<img src='"+imga+"'/
>
> > >");
> > });
>
> > ---------------------------------------
>
> > Want to get all the images with the "img" class and the append them in
> > the div "imgbox". But I can only return the first image. Does anyone
> > have any suggestions? Thanks.
>
> > EX:. these are the images that I want to get
> > ---------------------------------------
> > <a class="img" href="http://example.com/Zelda-01.jpg" >Galeria</a>
>
> > <a class="img" href="http://example.com/Zelda-02.jpg" >Galeria</a>
> > ...
> > ---------------------------------------
No comments:
Post a Comment