Why does jquery.animate in the text box display a blinking cursor?

I have the following code

$(document).ready(function() {
    $("#myTextArea").focus(function() {
        $("#myTextArea").animate({ "height": "75px"}, "normal");
        return false;
    });

to expand the text box when it becomes focus. Deployment does occur, but the blinking cursor disappears, at least in Firefox!

Edited: the text box is still focused and I can enter it.

Why is this happening? Is there any way to show this again?

Thanks in advance

+3
source share
1 answer

Your operator return falsecancels the action focus:). When the element is focused, you only get the cursor. I will just remove this line from your function.

, .focus() -, , , , CSS :

$("#myTextArea").focus(function() {
    $(this).css({ "height": "75px" });
});

saema (focus - ), , , . ( ) , , , :

$("#myTextArea").focus(function(e) {
    if($(this).height() == 75) return;
    $(this).animate({ height: 75}, "normal", function() {
        $(this).blur().trigger(e);
    });
});​

, , focus .

+3

Source: https://habr.com/ru/post/1741304/


All Articles