如何使用可选择的 Jquery UI 查找选定的元素
我正在寻找有关 jQuery 可选事件的事件和 ui 对象的信息:选择"和开始"作为参数.我在文档中找不到这个,循环遍历属性也无济于事.
I am looking for info on the event and ui objects the jQuery selectable events: "selecting", and "start" take as parameters. I cannot find this in the documentation and looping through the properties is no help.
$('#content_td_account').selectable({
filter: 'li:not(".non_draggable")',
selecting: function(event, ui) {
}
});
具体来说,我想找出正在选择的元素并检查它们以查看它们的父元素是否相同.我认为这将在 ui 对象中的某个位置.
Specifically I want to find what elements are being selected and check them to see if their parent elements are the same or not. I assumed this would be in the ui object some where.
推荐答案
当一个元素被选中时,它会添加 ui-selected
类.
When an element is selected it gets the ui-selected
class added.
所以你可以使用 $(".ui-selected")
这可能不完全有效,但我认为这个想法是这样的:
This might not work exactly but I think the idea would be something like this:
$('#content_td_account').selectable({
filter: 'li:not(".non_draggable")',
selecting: function(event, ui) {
var p = $(this).parent();
$(".ui-selected").each(obj, function() {
if(obj.parent() == p) {
// get rad
}
});
}
});
相关文章