問題描述
我正在尋找有關(guān) jQuery 可選事件的事件和 ui 對象的信息:選擇"和開始"作為參數(shù).我在文檔中找不到這個,循環(huán)遍歷屬性也無濟(jì)于事.
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) {
}
});
具體來說,我想找出正在選擇的元素并檢查它們以查看它們的父元素是否相同.我認(rèn)為這將在 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.
推薦答案
當(dāng)一個元素被選中時,它會添加 ui-selected
類.
When an element is selected it gets the ui-selected
class added.
所以你可以使用 $(".ui-selected")
這可能不完全有效,但我認(rèn)為這個想法是這樣的:
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
}
});
}
});
這篇關(guān)于如何使用可選擇的 Jquery UI 查找選定的元素的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!