Many times we need to get the div or any DOM elements height and width when these properties not defined.
Lets say I kept div height auto and width as 200px fix and data is dynamic for eash user. So how we can get the div height.
We can use two javascript functions for fetching the div height.
1. offsetHeight – this will return the value which are specified in your CSS
2. clientHeight – this function will return real inner height of element that does not matter about CSS.
I recomend to use this function.
Exmaple code as follows:
<style>
#wordpressapidiv{ width:200px; height:auto;border:#ccc 1px solid}
</style>
<div id=\"\wordpressapidiv">
This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content.
This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content.
This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content. This is dummy content.
This is dummy content. This is dummy content.
</div>
<script>
function getDivHeight(divID){
gd = document.getElementById(divID).clientHeight;
alert(gd);
}
function getDivWidth(divID){
gw = document.getElementById(divID).clientWidth;
alert(gw);
}
</script>
<input name="test" type="button" onclick="getDivHeight('wordpressapidiv')" >
Function above code you can fetch the div height and width using the javascript.



Pingback: Xbox 360 Console Repair Convert Unable Xbox In Workable Console | Xbox 360 Pro Bundle
Pingback: Underdog NY makes finalist list for Race to the Top | Paperless Media
Pingback: Fully Managed Windows Dedicated Server Hosting | Dedicated Website Hosting Info
Pingback: What Marie Osmond’s son wrote in suicide note | Paperless Media
Pingback: Was spricht gegen Billigwelpen ?
Pingback: Smoking Hot Blonde Veronika | Porry Babes
Pingback: Veronica Ricci | Porry Babes
Pingback: Intense Butt and Legs – Workout | Waist Belt , waist-belt.com
Pingback: Factory Outlets Shopping| Australia’s largest “Only Online” bargain shopping megastore. | Its Da Cinch
Pingback: SanDisk Sansa Clip 2 GB MP3 Player (Black) | Bestsellers in Electronics Reviews
Pingback: i m a gal 19 yrs yr old gal. i m weghing 68kgs.plz suggest some methods for fat loss? | Buy Fat Loss 4 Idiots
Pingback: Speed, Long Tail… | JimRGraham.com
Pingback: Apolo Ohno’s Olympic Workout | Waist Belt , waist-belt.com
Pingback: Get Your own search site for FREE to Earn Commissions | Trace Lost Relatives.com
Pingback: Jessica Simpson opens up about weight, John Mayer on ‘Oprah’
Pingback: Hot Abs Workout Abs | Mens Fitness Health
Pingback: Vibram Five fingers Review
Pingback: Auto Content Cash – Content For Automated Cash? | Alex Goad Auto Content Cash
Pingback: Jrue Holiday Workout: Sacramento Kings NBA Draft 2009 | Mens Fitness Health
Pingback: Enhance and Advance Your Career with an Online MBA Degree by eLearners.com
Pingback: 2-14-10 Tormentos.wmv | Cozumel Blog
Pingback: Work from home online!
Pingback: does anyone have or have heard of the skin disorder utecariapigmentosa bc i have that i was wandering if anyo? | Health Concerns
Pingback: Dance Fitness Workout for Beginners Tahitian Hip Hop DVD | Waist Belt , waist-belt.com
Pingback: What are some effective ways to lose fat, not weight? | Buy Fat Loss 4 Idiots
Pingback: lose weight? | Buy Fat Loss 4 Idiots
Pingback: Weight loss? | Buy Fat Loss 4 Idiots
Pingback: Information on a Fireplace Vacuum
Pingback: Easy Slipper Knitting Patterns Are Great For Beginners
Pingback: Velcro Bedroom Slippers
Pingback: educational toys electronic kits circuit | Hottest Holiday Toys
Pingback: UK’s economic recovery ‘is under threat’ – Telegraph.co.uk | Forex Megadroid System
Pingback: best systems of psych for understanding and development? | Personal Development Guide
Pingback: 1967 DODGE DART GT $15,995 |
Pingback: unique green couture | Terry Cloth Couture
Pingback: uberVU - social comments
Good informative text. I found your blog by accident, just thought I’d let you know that you have some really good info on here.
Pingback: Beach Wedding | Wedding Planning
I’m so glad I found your site. Its awesome.
Yours Sincerly
Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my hair removalblog?
nice blog, reminds me I must get around to adding more content on my own blog, kinda neglected them.
Pingback: My Blog Title
I like your site.I’ll come back later.great site and your writing style is amazing,just
You’ve certainly been really exceptionally on the run helpful hints off any of this amazing weblog, In your own home highly intriguing which you can understand. Can’t have to wait to see remedies produce within the up coming times. Believed mass pm would for your massive testimony, however , Fan genuinely supporting this excellent website, furthermore intention this advice, too as the excellent evaluations most other persons showed, usually support you have to choose if it turns out it’s unquestionably the proper option for you. May be the greatestthing.
Admiring the time and work you put into your weblog and detailed facts you present! I am going to bookmark your weblog and have my children examine up below typically. Thumbs up!
Hi there may I use some of the information here in this post if I provide a link back to your site?
would it be possible to translate your website into spanish because i have difficulties of speaking to english, and as there are not many pictures on your website i would like to read more of what you are writting
Hiya, excellent web blog, and a very good understand! one for my bookmarks.
Hey, thanks for the article post.Really looking forward to read more. Much obliged.
Thats really useful
Love this site. Nice read will have to recommend it to my co-workers.
This website really keeps on looking better every time I show up. You should truly be satisfied.
I really like this great site however you could make use of more clips kind of like they actually do on gawker
Help!!!! Neither of the 2 properties clientHeight and offsetHeight works for me! Could some one suggest any alternatives to find out the height of a div dynamically? Thanks a ton in advance.
Hi all,
I have to show a div onmouseover of an icon. It does get shown up, but in the bottom, so am unable to see the content. How do I format the div so that the div shows up right next to the icon itself? P.S. The div is actually a label created by a certain Label.js file. Could someone help me asap with this please? Thanks a ton in advance.
Great ideas and many inspirations, like it
Oh thanx this saved me!!! What a wonderful property!!!
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Awesome post. I so good to see someone taking the time to share this information
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Very interesting points you have remarked, thank you for posting .
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Awesome post. I so good to see someone taking the time to share this information
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader