JSFiddle - React, Tailwind, and code Playground

by Gabriele Petrioli

HTML

<div class="scrollable" style="overflow:hidden;">
    test testtest testtest testtest<br />
    testtest testtest testtest testtest<br />
    testtest testtest testtest testtest<br />
    testtest test TOST
</div>


<a href="#" onClick="alert(isHidingMyShit())"> check if your shit is hidden <a>

CSS

.scrollable{
    height:50px;
    margin-bottom:10px;
    border:1px solid #ccc;
}

JavaScript

function isHidingMyShit(){
    var $s = $('.scrollable');
    
    $s.wrapInner('<div />'); // wrap inner contents
    var hidden = $s.height() < $s.children('div').height();
    
    $s.children('div').replaceWith( $s.children('div').html() ); //unwrap
    
    return hidden;
}