Posts

Showing posts from January, 2016

How to retain the space of the td after hidding it in Jquery

Image
If you use the following code snippet to hide and show tds- the UI will get disturbed.
The next corresponding td will get shifted to the hidden td space.
var tablevar="#"+myTable;
 $(tablevar+' tr:eq('+i+')').find('td:eq(3)').show();
   $(tablevar+' tr:eq('+i+')').find('td:eq(2)').show();

So how to retain the td space and still achieve the functionality.
use the this code snippet.
var tablevar="#"+myTable;
$(tablevar+' tr:eq('+i+')').find('td:eq(3)').css("visibility", "hidden");
 $(tablevar+' tr:eq('+i+')').find('td:eq(2)').css("visibility", "hidden");

 $(tablevar+' tr:eq('+i+')').find('td:eq(4)').css("visibility", "visible");