开发者

Issue with click and blur event

开发者 https://www.devze.com 2023-04-13 05:08 出处:网络
I am using both click and blur event. Find my code at http://jsfiddle.net/CyQ2w/11/ When using only click event: everything works fines. A click on a list populates value in text area.

I am using both click and blur event. Find my code at http://jsfiddle.net/CyQ2w/11/

When using only click event: everything works fines. A click on a list populates value in text area.

When using both click and blur: A blur event takes priority and prevents click event to trigger.

Blur event is used only to hide div when textarea loses focus.

I have read about binding this two events to an element. But, in my case, elements [anchor and textarea] a开发者_运维技巧re different.

Any help would be appreciated.


$(document).bind("click",".username", function() {
      $("#message_board").val($("li.hovered div").text());
    return false;
});

this one should help. Also i recommend you migration to newest jquery and to use .on method instead of .bind

0

精彩评论

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