javascript - How do you dynamically apply style to an element, type and class in jQuery? -
i need apply style:
<style> #elementid td[role='gridcell'] { height: 136px !important; } </style>
but need calculate height dynamically. how can set style using javascript?
thanks! in advance!
1) in css use of calc
function.
read more
calc
: https://www.w3schools.com/cssref/func_calc.asp
for example :
#elementid td[role='gridcell'] { height: calc(100%-20px) !important; }
2) in jquery.
for example:
$(document).ready(function(){ var dynamic = calculate.... $("#elementid td[role='gridcell']").css("height", dynamic); })
wiki
Comments
Post a Comment