How to get a collection of divs with jquery?

Posted by Gal Miller on Stack Overflow See other posts from Stack Overflow or by Gal Miller
Published on 2011-02-11T15:23:48Z Indexed on 2011/02/11 15:25 UTC
Read the original article Hit count: 179

Filed under:
|

I want to get the second img:

<form id="formElem" name="formElem" action="" method="post">
                    <fieldset class="step">
                        <img src="1.jpg" >
                    </fieldset>
                    <fieldset class="step">
                        <img src="2.jpg" >
                    </fieldset>
                    <fieldset class="step">
                        <img src="3.jpg" >
                    </fieldset>
                </form>

I tried doing something like:

var imgSRC = $("div[id ='step']").get(1).find('img').attr('src'); 
alert(imgSRC);

Got nothing....

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery