Hi Ishara, To get the second list item try[1] with replacing n with intended item number.
[1] $( ".list1 li img:nth-child(n)" ); Also add the class name into <ul> tag as <ul class="list1">. For further reference you can try [2] for JQuery :nth-child() selector. [2] http://api.jquery.com/nth-child-selector/ Regards, On Fri, Feb 27, 2015 at 3:22 PM, Ishara Cooray <isha...@wso2.com> wrote: > Hi, > I have an img tag inside a unordered list item as follows. > > <ul> > <li><img src="next.jpg" class = > "img-list2">UPPERCASE,</li> > <li><img src="next.jpg" class = > "img-list3">lowercase,</li> > <li><img src="next.jpg" class = > "img-list4">digits,</li> > <li><img src="next.jpg" class = > "img-list5">Special characters.</li> > </ul> > I want to change this image dynamically. There fore i was trying to get > the img reference by > var image = $('.list1 li img:first'); > image.attr("src", v); > But this does not update the image as i expected. > How can i get this working? > > Also, i can get the first <img> as above. But how can i get the <img> of > second list item? > > Thanks > Ishara Cooray > Senior Software Engineer > Mobile : +9477 262 9512 > WSO2, Inc. | http://wso2.com/ > Lean . Enterprise . Middleware > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Malith Munasinghe | Software Engineer M: +94 (071) 9401122 E: mali...@wso2.com W: http://wso2.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev