jquery - Get height ul first -


i´m using $(this).find("ul").filter(":first").height(); first ul.

but height not defined, height -20

my ul:

ul style="width: 252px; min-width: 820px; padding-bottom: 20px;" class="jqx-tree-dropdown-root" 

best regards.

i created quick jsfiddle displays rather code should work fine. using "this" incorrectly :)

https://jsfiddle.net/qoxub22u/

html mockup

<div class="container">   <h5>first 1 has height of 40px</h5>   <ul style="height:40px">     <li>test</li>     <li>test1</li>   </ul>    <h5>second 1 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 ur selector */   var height = $('.container').find("ul").filter(":first").height();    alert(height); }); 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -