NOT A DUPLICATE because I'm asking for an "offclick"
event (if any) for the purpose of hiding an element, not how to hide the element.
I have a container with display: none;
that it's only shown when clicking on a <textarea>
tag by using onclick="myFunction()"
. However, I'd like to set the container back to display: none;
once it is clicked outside the <textarea>
.
Is there any offclick
equivalent for this?
function myFunction() {
$('.testing').css({
display: 'inline-block'
});
}
.testing {
display: none;
}
<div>
<textarea onclick="myFunction()" placeholder="Write something..."></textarea>
</div>
<div class="testing"></div>