In summary, Requirement: If data present populate div with text If not data present hide div but retain overall table vertical height
Implementation:
html:
<tr>
<td>
<div id= 'div_car_close_out' class='car_close_out'></div>
</td>
</tr>
css:
div.car_close_out {
border: 2px inset #D5D0D0;
text-align: left ;
overflow-y:scroll;
height:35px;
background-color: white;
}
javascript:
if (arr_task[0].CarClosedOutDate == " ") {
document.getElementById("div_car_close_out").style="visibility:hidden";
} else {
document.getElementById("div_car_close_out").innerHTML = arr_task[0].CarCloseOut;
document.getElementById("div_car_close_out").style="visibility:visible";
}
This works perfectly in FF However in Chrome, IE and Safari div element is not hidden.
It is possible to use visibility:collapse, but then overall table vertical size is reduced, and positioning of elements below is not correct.
I've failed to find any solution to this seemingly simple requirement. Can any make any suggestions?