JSFiddle - React, Tailwind, and code Playground

HTML

<button id="open">open</button>
<button id="close">close</button>
<div id="textselector-body">
    a<br/>
    b<br/>
    c<br/>
</div>

CSS

#textselector-body{
    width:400px;
    height:auto;
    border:1px #000 solid;
    margin:0;
    padding:0;
    overflow:hidden;
}

JavaScript

$(document).ready(function(){
    var H = $("#textselector-body").height();
    $("#open").click(function(){
        $("#textselector-body").animate({
            height:'100px' //here is problem. I need it 'auto'.
        },2000);
    });
    $("#close").click(function(){
        $("#textselector-body").animate({
            height:H
        },2000);
    });
});