set all table row heights to height of one row with JavaScript/CSS | XM Community
Skip to main content

I would like to dynamically set the height of other rows in a table to the height of a specific row in this table. Because this one large row has different heights, depending on the screen size, I would like to do this with JavaScript. My table looks like this:



 





 



 
 
 
 
 
 
 
   
    
  
 
 
   
  
  
 
 
   
  
  
 
 
 
 AB
featurebla bla
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.bla bla


Then I tried to adjust the height of the row with feature
f1
to the height of feature
f2
:
var maxHeight = document.getElementById("f2").clientHeight;
document.getElementById('f1').style.height=maxHeight;
This works when I inspect the table with Google Chrome and add these last two lines to the console but when I add the JavaScript code in Qualtrics, it does not. Any idea why?

Try:
var maxHeight = document.getElementById("f2").clientHeight;
document.getElementById('f1').style.height=maxHeight+"px";


Leave a Reply