jqueryUI Sortable:在表单输入上处理.disableSelection() [英] jqueryUI Sortable: handling .disableSelection() on form inputs

查看:569
本文介绍了jqueryUI Sortable:在表单输入上处理.disableSelection()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:我有一个无序列表,其中包含一堆表单输入.

在创建ul .sortable()之后,我在可排序(ul)上调用.disableSelection()以防止在拖动li项目时选择文本.

..一切都很好,但是我需要在表单输入中重新/启用文本选择..或表单基本上是不可编辑的..

我找到了部分解决方案@ http://forum.jquery .com/topic/jquery-ui-sortable-disableselection-firefox-issue-with-inputs

有什么想法吗?

解决方案

已解决.一点点的破解,但有效! ..有什么意见我可以做得更好吗?

应用.sortable(),然后在输入字段上启用文本选择:


$("#list").sortable({
  stop: function () {
    // enable text select on inputs
    $("#list").find("input")
     .bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e) {
      e.stopImmediatePropagation();
    });
  }
}).disableSelection();

// enable text select on inputs
$("#list").find("input")
 .bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e) {
  e.stopImmediatePropagation();
});

example: i have an un-ordered list containing a bunch of form inputs.

after making the ul .sortable(), I call .disableSelection() on the sortable (ul) to prevent text-selection when dragging an li item.

..all fine but I need to re/enable text-selection on the form inputs.. or the form is basically un-editable ..

i found a partial solution @ http://forum.jquery.com/topic/jquery-ui-sortable-disableselection-firefox-issue-with-inputs

any thoughts?

解决方案

solved . bit of hack but works! .. any comments how i can do this better?

apply .sortable() and then enable text-selection on input fields :


$("#list").sortable({
  stop: function () {
    // enable text select on inputs
    $("#list").find("input")
     .bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e) {
      e.stopImmediatePropagation();
    });
  }
}).disableSelection();

// enable text select on inputs
$("#list").find("input")
 .bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e) {
  e.stopImmediatePropagation();
});

这篇关于jqueryUI Sortable:在表单输入上处理.disableSelection()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆