How to find the width of the div or check wheather horizontal scroll apeear or not?

Posted by Salil on Stack Overflow See other posts from Stack Overflow or by Salil
Published on 2010-06-17T10:42:14Z Indexed on 2010/06/17 10:53 UTC
Read the original article Hit count: 196

I want to print the page (div) if there is no horizontal scroll appear for that div. I have a div (1000px) with dynamic data which having property overflow:auto;. So, i want to print the div only if div's width is not getting crossed. to achieve this i used following method of a javascript

var curr_width = parseInt(mydiv.style.width); 

But it gives 1000px; only althogh i can see horizontal scrollbar for the div.

What should i do to achive this.

Can i check wheather horizontal scrollbar is appear for the div or not.

Any help is appreciated.

NOTE:- i don't want to use any javascript library.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html