0

I'm becoming mad with some simple javascript stuff.

I need a simple javascript to test the offsetHeight of a table to dinamically set its div container.

I can get the correct value in tableHeight , but the "if" conditions do not work..

Here the code:

var tableHeight = parseInt(document.getElementById("tableData").offsetHeight);

if ( tableHeight>250 ) 
     {
     document.getElementById("tableContainer").style.height = "250px";
     } 

else 
{
BLABLBLABLA
 }

Any suggestion? Thanks guys

1 Answers1

0

I have just tested your code, and it works fine.

Here is a jsfiddle: http://jsfiddle.net/k7ug4/

Maybe you forgot to give the tables id's try to console log in the if

if ( tableHeight>250 ) {
 console.log('more than 250');
}