English 中文(简体)
检查是否点击 div 触发模糊
原标题:Check if blur was triggered by click on div

I have an input and on blur I want to save the value. The problem is that I have autocomplete on and when the users clicks on a suggestion from the autocomplete list the blur is triggered.

例如: 用户在输入中输入“ iP ”, 然后从自动完整列表中单击“ iPhone ” 。 在这个种性中, “ iP” 和“ iPhone” 的值被存储( “ iP” 仓库由模糊和“ iPhone” 仓库被自动完全点击触发) 。

我想检查一下 模糊的动作是否是由 自动完整的列表上的点击触发的

$( input ).blur(function(e){
  if(e.IsClickOnAutocomplete)
     return;
  else save_value;
});

那么,我怎样才能检查 模糊点是如何被触发的呢?

EDIT Here, a jsFiddle that shows something simillar to my problem http://jsfiddle.net/mkp8m/1

最佳回答

OK,在明确你所说的 autofect 是什么意思后,这里是解决办法。

使用 < a href=" "http://jqueryui.com/demos/autoffym/#event-change" rel="nofollow"\\ code> change 自动完整的插件事件 :

change: function(event, ui) {
    // save(this.value);
}

DEMO: http://jsfiddle.net/mkp8m/2/

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签