JSFiddle - React, Tailwind, and code Playground
HTML
<div id="draggable">
<textarea></textarea>
</div>
CSS
body{
background-color: #ccc;
}
#draggable{
background-color: blue;
display: inline-block;
padding: 75px;
}
JavaScript
$("textarea").focusout(function(){
alert("Do something");
}).click(function(e){
e.stopPropagation();
return true;
});
$("#draggable").draggable({
start: function( event, ui ) {
if( $('textarea:focus', this).length ){
$('textarea', this).focusout();
}
}
}).click(function(e){
if( $('textarea:focus', this).length ){
$('textarea', this).focusout();
}
});