JSFiddle - React, Tailwind, and code Playground
HTML
<textarea>Test</textarea>
<div>Test</div>
CSS
div { background-color: blue; position: absolute;}
JavaScript
$("textarea").bind("resize", function() {
$("div").css('width', $(this).css('width'));
$("div").css('height', $(this).css('height'));
});
$("textarea").bind('mousedown.shiftenter', function(){
// Reposition while the mouse is down, use might have clicked on resize handler
$(this).bind('mousemove.shiftenter', function() {
var $el = $(this);
var old_size = $el.data('textarea_resize');
if (!old_size) {
$el.trigger('resize');
} else {
var new_size = {width: $el.width(), height: $el.height()};
if (old_size.width != new_size.width || old_size.height != new_size.height) {
$el.trigger('resize');
$el.data('textarea_resize', new_size);
}
}
});
});
$("textarea").bind('mouseup.shiftenter', function(){
$("textarea").unbind('mousemove.shiftenter');
});