i have div bunch of other divs , images. main div m-carousel-inner. want select first img element within div. how go doing in javascript or jquery?
<div class="m-carousel-inner"> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <a href="#"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </a> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> <div class="m-item"> <div class="m-card-light"> <div class="mqc_img"> <img src="http://placehold.it/280x210"> </div><!-- end .mqc_img --> <div class="mqc_info"> <h5>title</h5> lorem ipsum dolor sit amet </div><!-- end .mqc_info --> </div> </div> </div><!-- end .m-carousel-inner -->
thank you.
like this?
$('.m-carousel-inner').find('img:first');
see :first
first part $('.m-carousel-inner')
selector container element class .m-carousel-inner
return jquery wrapped dom element, , apply .find('img:first')
find first instance of img child @ level.
Comments
Post a Comment