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: 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: Vibram Five fingers Review
Pingback: Auto Content Cash – Content For Automated Cash? | Alex Goad Auto Content Cash
Pingback: 2-14-10 Tormentos.wmv | Cozumel Blog
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
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
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!
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!
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
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.
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 .
Great work! That is the kind of info that should be shared around the internet. Disgrace on Google for not positioning this put up higher! Come on over and consult with my website . Thanks =)
I realized that the values got messed up … I meant between 0 and 100 ; between 100 and 200 and so on. Sorry
Thanks for the tips shared on your blog. Something else I would like to mention is that fat loss is not about going on a dietary fad and trying to lose as much weight that you can in a few months. The most effective way to shed pounds is by using it slowly and right after some basic guidelines which can allow you to make the most through your attempt to lose weight. You may understand and already be following some tips, but reinforcing expertise never affects.