I´m using $(this).find("ul").filter(":first").height(); to get first ul.
But the height is not defined, then the height is -20
My ul:
ul style="width: 252px; min-width: 820px; padding-bottom: 20px;" class="jqx-tree-dropdown-root"
Best Regards.
I´m using $(this).find("ul").filter(":first").height(); to get first ul.
But the height is not defined, then the height is -20
My ul:
ul style="width: 252px; min-width: 820px; padding-bottom: 20px;" class="jqx-tree-dropdown-root"
Best Regards.
I created a quick jsFiddle which displays rather well that your code should work just fine. However you are probably using "this" incorrectly :)
https://jsfiddle.net/qoxub22u/
Html mockup
<div class="container">
<h5>First one has height of 40px</h5>
<ul style="height:40px">
<li>Test</li>
<li>Test1</li>
</ul>
<h5>Second one has height of 70px</h5>
<ul style="height:70px">
<li>Test</li>
<li>Test1</li>
<li>Test2</li>
<li>Test3</li>
</ul>
</div>
<button id="submit">Get height</button>
Jquery part
$( "#submit" ).click(function() {
/* Replace .container with ur this selector */
var height = $('.container').find("ul").filter(":first").height();
alert(height);
});
$(this) is a div.
$(this) is the same:
var self = $(this); alert(self.find("ul").filter(":first").height());
The UL height is not defined.