开发者

jQuery textarea onclick out

开发者 https://www.devze.com 2023-03-26 01:18 出处:网络
Hello I have a textarea. On Focus a new div will show up, it is a counter. The pr开发者_如何学编程oblem is that I want to Hide this DIV again when the textarea does not have the focus anymore. So ma

Hello I have a textarea.

On Focus a new div will show up, it is a counter.

The pr开发者_如何学编程oblem is that I want to Hide this DIV again when the textarea does not have the focus anymore. So maybe onClickout?

Is there a way to achieve this?

This is what I am using to show the DIV, now I need to hide it when the textarea does not have the focus on.

$("#message").focus(function(){
        $(".counter").fadeIn();
});


The partner of the focus event is the blur event:

$("#message").focus(function(){
  $(".counter").fadeIn();
}).blur(function(){
  $(".counter").fadeOut();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消