JSFiddle - React, Tailwind, and code Playground
HTML
<img id="language_arrow_bottom" src="http://placehold.it/32/ff0000" width="13px" height="13px" alt="" />
<img id="language_arrow_up" src="http://placehold.it/32/000000" width="13px" height="13px" alt="" style="display:none;" />
JavaScript
$(document).ready(function () {
$('#language_arrow_bottom').click(function (event) {
$('#language_arrow_bottom').hide();
$('#language_arrow_up').show();
});
$('#language_arrow_up').click(function (event) {
$('#language_arrow_up').hide();
$('#language_arrow_bottom').show();
});
$(document).mouseup(function (e) {
var container = $('#language_arrow_up');
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.hide();
$('#language_arrow_bottom').show();
}
});
});