TyForHelpDude TyForHelpDude - 10 months ago 43
Javascript Question

jquery edit style attributes and values

i need to edit style attributes of a div element:

here is my div element:

<div class="pp_content pre-scrollable" style="height: 206px; width: 544px;">

when I triger an event I want this element:

<div class="pp_content pre-scrollable" style="min-height: 206px; width: 544px;">

only height transformed to min-heigth with same values.

I need something like :

How can I do this with jquery ?

Answer Source

@KarthkeyanVedi answer is close, here is how to do that but use the old value of height other than a static number:

var oldHeight = $(".pp_content.pre-scrollable").css('height');
$(".pp_content.pre-scrollable").css({ 'height' : '', 'min-height' : oldHeight });