Answers for "change div height dynamically jquery"

4

how to set height dynamically in jquery

// Calculate height according to the div width
$(function() {
  var myDivWidth = $(".main-div").css("width") + "px";
  // the variable will now have our div width
  $(".main-div").css("height", myDivWidth)
  // Another Way
  $(".main-div").css({
    "height": myDivWidth
  })
})
Posted by: Guest on June-12-2021
1

jquery set div height dynamically

$(document).ready(function() {
    var divHeight = $('.col-1').height(); 
    $('.col-2').css('min-height', divHeight+'px');
});
Posted by: Guest on May-26-2021

Code answers related to "change div height dynamically jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language