jQuery do something when element is shown

I want my code to execute when an element is shown.Try this: var visible = $("#ele"/*select the element*/).is(":visible"); console.log(visible); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="ele"></div>