html - MooTools - find height of div id for certain a div class -


i trying use offsetheight find height of element based on class, far can find height based on div id, if have multiple classes assigned same id?

i adapted jsfiddle exemplify i'm talking about: http://jsfiddle.net/vvras/80/

var idheight = $('textarea').offsetheight;     var classheight1 = $$('.field').offsetheight;     var classheight2 = $$('.field2').offsetheight; 

where field , field2 div classes, , textarea div id

i want undefined values give height of div based on class.

thanks.

the $$ selector behaves queryselectorall, in not return single element, nodelist containing multiple elements, even when 1 element matches query.

nodelists can traversed arrays, in case:

var classheight1 == $$('.field')[0].offsetheight; var classheight2 == $$('.field2')[0].offsetheight; 

in essence, when called $$('.field'), asked mootools find instances of elements containing class field. returned nodelist of 1 item, you'll still need reference via array index.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -