20 Sep 2017

Table height 100%

Giving a table (or any other container) the 100% height of its containg parent totally sucks. yes, it can be done with CSS, but sometimes you need to do it with javascript.

.instance is the class name of the parent container

.tab is the class name of the table (or other containing element).


<script type="text/javascript">
// table cell height 100%
$(document).ready(function(){
var b= $(".instance").height(); //gets the window's height, change the selector if you are looking for height relative to some other element
$(".tab").css("height",b);
});
</script>