I like to stick to vanilla js for whatever reason. so here's a simple solution in vanilla:
<textarea
onmousedown="storeDimensions(this)"
onmouseup="onresizeMaybe(this)"
></textarea>
<script>
function storeDimensions(element){
element.textWidth = element.offsetWidth;
element.textHeight = element.offsetHeight;
element.value = "is it gonna change? we don't know yet...";
}
function onresizeMaybe(element){
if (element.textWidth===element.offsetWidth
&& element.textHeight===element.offsetHeight)
element.value = "no change.\n";
else element.value ="RESIZED!\n";
element.value +=
`width: ${element.textWidth}\n`
+`height: ${element.textHeight}`;
}
</script>
and for homework, use onmousemove
to trigger the resize event instead of onmouseup
(I didn't need that in my particular case).
:) hope it helps someone someday... seeing as how this question is now 5 years old.