I'm trying to get the width of a parent from an element. To do this I'm using:
parent = $("#"+id).parent().attr("id");
parentWidth = $('#'+parent).width();
I've also tried:
parentWidth = $('#'+parent).css('width');
At first I used
$('#'+id).parent().width();
this didnt work either.
The parent variable is correctly set, however, the width of a parents div is 90%, .width() returns 90, and .css('width') returns 90px. In my .css widht is set to 90%, i also tried adding it in the style tag in the element itself.
<div id="tabs" style="height:90%;width:90%;">
in the CSS file:
#tabs{
height:90%;
width:90%;
position:absolute;
z-index:10;
overflow:hidden;
}
I keep getting 90 as return value. What am I doing wrong? Thanks
This is the page I'm talking about: http://www.amsterdamslyceum.lelie.demodomein.com/index.php Don't mind the db errors, didnt set up the db on the host yet as I just started developing.
$('#' + id).parent();and there's no need to find it by id like that.#tabsdiv has a100pxwidth, it would be legitimate forwidth()andcss()to return90px. Are you sure that isn't the case?