gpt4 book ai didi

javascript - 如何取消选择 jQuery Selectable 中的元素?

转载 作者:太空宇宙 更新时间:2023-11-04 13:07:29 24 4
gpt4 key购买 nike

如何取消选择 jQuery Selectable 中的元素?在这Link如何使用 jQuery Selectable 有很好的文档记录,但从未提及如何再次取消选择选定的元素。有什么想法吗?

<script>
$(function() {
$( "#selectable" ).selectable({
stop: function() {
var result = $( "#select-result" ).empty();

$( ".ui-selected", this ).each(function() {
var index = $( "#selectable li" ).index( this );
result.append( " #" + ( index + 1 ) );
});
}
});
});
</script>

<ol id="selectable">
<?php
for($i=1;$i<=9;$i++) {
echo "<li id=\"field_$i\" class=\"ui-state-default\">$i</li>";
}
?>
</ol>

最佳答案

按住 ctrl 并单击元素。它还可用于进行多项选择。

关于javascript - 如何取消选择 jQuery Selectable 中的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24997370/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com