【问题标题】:jQuery selectable with another eventjQuery 可选择与另一个事件
【发布时间】:2013-05-29 00:43:26
【问题描述】:

我在这样的表上使用可选择的 jQuery...

 var body=$("<tbody class='selectable'></tbody>")
 body.selectable({
     filter: 'td:not(:first-child)'
 });
 // this is the first column which is filteres out of the selectable
 $(".first-col").on('click',function(e){
      console.log("click for first column is here");
 });

我希望第一列具有不同的回调函数,但永远不会调用对第一列的单击。是否有可能做到这一点?我做错了什么?

感谢您的帮助 V

【问题讨论】:

  • 为什么不能将点击事件附加到'.selectable'?

标签: jquery jquery-ui-selectable


【解决方案1】:

这实际上是一个已知的可选择的“错误”。您可以将距离选项设置为 0(默认值)以外的任何值来解决此问题,但最好的方法是将单击更改为鼠标按下(可行)。

示例...

 $(".first-col").on('mousedown',function(e){
      console.log("click for first column is here");
 });

【讨论】:

    猜你喜欢
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-16
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多