Event TEXTAREA Resizing

Asked

Viewed 43 times

0

I want a way to catch the textarea event when it is clicked on your resize arrow.

1 answer

2


With the event mousemove you can detect when the textarea is resized by storing the current dimensions in variables:

var largura = $("textarea").width();
var altura = $("textarea").height();
$("textarea").on("mousemove", function(){

    var larg_atual = $(this).width();
    var altu_atual = $(this).height();

    if(larg_atual != largura || altu_atual != altura){
        largura = larg_atual;
        altura = altu_atual;
        console.log("Tamanho alterado");
    }

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea></textarea>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.