how to set height dynamically in jquery

Solutions on MaxInterview for how to set height dynamically in jquery by the best coders in the world

showing results for - "how to set height dynamically in jquery"
Fabiana
31 Jan 2019
1// Calculate height according to the div width
2$(function() {
3  var myDivWidth = $(".main-div").css("width") + "px";
4  // the variable will now have our div width
5  $(".main-div").css("height", myDivWidth)
6  // Another Way
7  $(".main-div").css({
8    "height": myDivWidth
9  })
10})
Martina
30 Aug 2016
1$(document).ready(function() {
2    var divHeight = $('.col-1').height(); 
3    $('.col-2').css('min-height', divHeight+'px');
4});  
5
Andrés
17 Apr 2017
1$('elem').height();
2