I want to check if there's an overflow in a table cell and if there's no overflow remove a class that disables scrolling in the cell. I want to to this by comparing clientHeight & scrollHeight properties. If I call $(this) I see:
So as far as I understand I need to get the properties from the first element of the array? But when I call $(this)["0"].clientHeight or $(this).get(0) i receive a value of a child property rather than a div's in which this child resides. How can I get properties of
<div class="scrollable verticalCenterAligned">
What am I missing? Thanks!
HTML:
<td>
<div class="scrollable verticalCenterAligned">
<div class="form-group">
@media.Selector
</div>
</div>
</td>
<td>
<div class="scrollable verticalCenterAligned">
@Html.DisplayFor(modelItem => media.MediaRSSURL)
</div>
</td>
JavaScript:
$('.scrollable').each(function() {
console.log($(this));
console.log($(this)["0"].clientHeight);
console.log($(this)["0"].scrollHeight);
});
</script>
ScreenShot of console:
on the screen you see that I'm getting the value of the child node property but not of the div in which this child resides.