JSFiddle - React, Tailwind, and code Playground
by petersendidit
HTML
<script src="https://github.com/cowboy/jquery-outside-events/raw/v1.1/jquery.ba-outside-events.js"></script>
<input type="text" id="input" /><br />
<p id="p" style="background:red;display:none;">
Click me.
</p>
<input type="text" id="input2" />
JavaScript
$(document).ready(function() {
$("#input").focus(function() {
$("#p").show();
}).bind('focusoutside', function(event) {
if (!$(event.target).is('#p')) {
$("#p").hide();
}
});
$("#p").click(function() {
alert("Thanks for clicking me");
});
});