I am going to make my question as short as possible. I have a textarea that gets hidden whenever it is blurred :
$('textarea').on('blur', function(){
$(this).hide()
})
I want to check first wither a button is clicked or not
if clicked => keep the textarea showen
if not clicked => hide the textarea
the only problem is that the button i want to check is the same button that made the textarea visible
$('button').click(function(){
$('textarea').show().focus()
})
So I do not want the textarea to flash whenever i click the button (prevent it from hiding if the button is clicked, and let it hide in peace if it's blurred on other element)
this is a Demo
I thought of making a flag but it's a dilemma