How to select all images using jquery and give them an width?

you don’t need to use for each you can select all images like below method.

<div class="body">
   <img src="https://stackoverflow.com/questions/45272871/some-src" > 
   <img src="https://stackoverflow.com/questions/45272871/some-src" >
   <img src="https://stackoverflow.com/questions/45272871/some-src" >
   <img src="https://stackoverflow.com/questions/45272871/some-src" >
</div>
$(document).ready(function () {
    $('div.body img').css("width","200px");
});

Leave a Comment