I can blur my input by clicking anywhere on the page except the jQuery Sortable list. How can I fix this? UPD: demo
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
$('sortable').mousedown(function(){
document.activeElement.blur();
});
回答2:
Take a look at the cancel option from the jquery-ui
$("#sortable").sortable(cancel: 'input');
You'll have to remove the $("#sortable").disableSelection();
See my jsfiddle
UPDATE
I understand your problem. Because jQuery stops the default functionality of the browser when sorting a list, the blur is never called for that field. You'll have to force the field to blur.
See my jsfiddle. I use change to call the blur, you can change 'change' to 'start' if you want the blur to always happen.
回答3:
It is a bug of jquery sortable, which will be fixed in jqueryui 2.0.0. See Sortable: clicking a sortable item does not cause form element to blur
回答4:
To limit the handle to a specific element that is not a input solved it for me.