how can I get DOM object to get some properties of HTML elements with jQuery? For example I want to get dimensions of image after document loaded.
Here is my code:
$(function() {
var divs = $("#thumbnails_div").children();
console.log(divs);
console.log(divs[1]);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="thumbnails_div" class="article_content row">
<div class="col-2">
<img src="img/1.jpg" alt="Kubota" class="img_thumbnail">
</div>
<div class="col-2">
<img src="img/2.jpg" alt="Kubota" class="img_thumbnail">
</div>
First console.log()gives me DOM object, but the second one only string representation of one of children...but I need real object to iterate throught it (to get dimensions of every image). How can I do it?
There is my result of second console.log():
<div class="col-2">
<img src="img/2.jpg" alt="Kubota" class="img_thumbnail">
</div>
divswill be a jQuery collection, not a DOM object.divs[1]will be anHTMLDivElement, not a string, which should be perfectly interactable with