Click on jQuery Sortable list does not blur input

╄→гoц情女王★ 提交于 2020-01-01 05:39:11

问题


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.



来源:https://stackoverflow.com/questions/8869708/click-on-jquery-sortable-list-does-not-blur-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!