When I click on a button, I want to increment a div height by 25%, so I would like to be able to get the last div height value as a % and simply add 25 to this.
Is there a javaScript method that would return '80%' which is the height define in the CSS, and not return the calculated px value of the element at 80%?
<div class="container">
</div>
html, body {
margin: 0;
height: 100%;
width: 100%;
}
.container {
height: 80%;
background: #eee;
}
let container = document.querySelector('.container');
console.log(container.style.height); //Empty
console.log(container.clientHeight); //Calculated px value at 80%
//I am looking for a method/way to return '80%'