0

I'm printing data's dynamically in javascript using document.createElement. Is there any way to lock the first column when scrolled horizontally?

var row = document.createElement("TR");

//Name
var td1 = document.createElement("TD");
var element1 = createSpan(Id, NameName);
td1.appendChild(element1);
row.appendChild(td1);

//Phone
var td2 = document.createElement("TD");
var element2 = createSpan(phoneId, phoneName);
td2.appendChild(element2);
row.appendChild(td2);

//Email
var td2 = document.createElement("TD");
var element2 = createSpan(emailId, emailName);
td2.appendChild(element2);
row.appendChild(td2);
. 
.
.
.

I want to lock the Name column while scrolling horizontally. So that, the Name stays in the 1st position and the remaining columns moves.

Sam
  • 513
  • 1
  • 11
  • 27
  • Possible duplicate of [how do I create an HTML table with fixed/frozen left column and scrollable body?](https://stackoverflow.com/questions/1312236/how-do-i-create-an-html-table-with-fixed-frozen-left-column-and-scrollable-body) – Nico Van Belle Jun 13 '17 at 11:23
  • I tried using `position: absolute` as said in the mentioned thread. It locks the column when moved vertically, but not horizontally. – Sam Jun 13 '17 at 11:43

0 Answers0