我需要将ul设为可选,只有条件为真。怎么做?
if($(".ci-journey-interactions-canvas__journey-
list").hasClass("staged")){
$( ".ci-journey-interactions-canvas__journey-
list" ).selectable( "disable" );
}else{
$(.ci-journey-interactions-canvas__journey-
list).selectable({});
}
我需要检查动态添加的课程" staged:如果他们上过课,我不想工作可选。
答案 0 :(得分:0)
尝试使用jquery selectable的过滤器选项。
http://api.jqueryui.com/selectable/#option-filter
$( "ul" ).selectable({
filter: 'li:not(.staged)'
});
修改强>
在父项上调用可选方法。按孩子过滤。