jQuery UI可选禁用
我使用jQuery UI Selectable可用于有序列表中的列表项,但我只想禁用该ol中的一个列表项,是他们的任何方式吗? 这是我的代码
- enable & selectable
- enable & selectable
- enable & selectable
- disable & not selctable
$( "#selectable" ).selectable();
可选窗口小部件提供了一个filter
选项,可用于包含匹配元素的子项:
$("#selectable").selectable({ filter: ".something" //Give the elements to be selectable a class });
您的HTML看起来像这样:
- enable & selectable
- enable & selectable
- enable & selectable
- disable & not selctable
这是一个有效的例子 。
如果要排除的li
始终是最后一个,就像在您的示例中一样,您可以避免向每个li
元素添加一个类,并使用:not
和:last
selectors:
$("#selectable").selectable({ filter: "li:not(:last)" });