I need to hide a div with some content when a input is clicked, but when the input is focus by tab the content should be showed. Currently i can show and hide the div with the content but i can't handle well the focus when is clicked i have a bounce because is focus and clicked at the same time.
Here's my code
$(function() { $('.myinput').click(function(e) { $('.text').addClass('hidden'); console.log("click"); }); $('.myinput').focus(function() { $('.text').removeClass('hidden'); console.log("focus"); }); }); .hidden { display: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="container"> <input class="myinput" type="text" /> <div class="text"> <div>TEXT TEXT TEXT</div> <div>TEXT TEXT TEXT</div> <div>TEXT TEXT TEXT</div> </div> </div>