Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click on jQuery Sortable list does not blur input

I can blur my input by clicking anywhere on the page except the jQuery Sortable list. How can I fix this? UPD: demo

like image 884
whitered Avatar asked Jan 15 '12 12:01

whitered


2 Answers

$('sortable').mousedown(function(){
  document.activeElement.blur();
});
like image 141
whitered Avatar answered Sep 30 '22 08:09

whitered


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.

like image 37
Tim Avatar answered Sep 30 '22 07:09

Tim