jQuery UI Selectable-单击时取消选择所选项目 [英] jQuery UI Selectable - unselect selected item on click

查看:203
本文介绍了jQuery UI Selectable-单击时取消选择所选项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否有一种方法可以配置jQuery ui可选元素以在单击时取消选择所选元素吗?有点像拨动开关.如果已选择它,请取消选择它,否则执行默认行为.

Does anyone know if there's a way to configure a jquery ui selectable element to unselect the selected element when you click it? Sort of like a toggle. If it's already selected, unselect it, otherwise do the default behavior.

谢谢.

推荐答案

我回答您的问题很晚了,但是无论如何我还是要回答一下,以便于其他人参考.

i'm very late in responding to your question, but let me just answer it anyway so that to keep it as a reference for others.

$( ".selector" ).bind( "mousedown", function ( e ) {
    e.metaKey = true;
} ).selectable();

这将允许您要查找的切换行为.

this will allow the toggle behavior that you're looking for.

这篇关于jQuery UI Selectable-单击时取消选择所选项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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