【发布时间】:2012-10-10 04:30:56
【问题描述】:
我正在使用可排序的 Jquery。
如果可拖动输入(项目)(具有名为“giveavalue”的类)在第一个列表 (sortable1) 中,我希望输入“Iwanttogetavalue”从该输入中获取值。
这是我的代码:
<input type="text" id="Iwanttogetavalue">
<ul id="sortable1" class="connectedsortables">
</ul>
<ul id="sortable2" class="connectedsortables">
<li><input type="text" class="giveavalue"></li>
<li><input type="text" class="giveavalue"></li>
</ul>
<script>
$(function() {
$("#sortable1").sortable({
connectWith: '.connectedsortables',
receive: function(event, ui) {
if ($(this).children().length > 1) {
//ui.sender: will cancel the change.
//Useful in the 'receive' callback.
$(ui.sender).sortable('cancel');
}
}
})
$("#sortable2").sortable({
connectWith: '.connectedsortables',
receive: function(event, ui) {
if ($(this).children().length > 10) {
//ui.sender: will cancel the change.
//Useful in the 'receive' callback.
$(ui.sender).sortable('cancel');
}
}
}).disableSelection();
});
</script>
谢谢!
【问题讨论】:
-
你知道 inputA 的值是多少吗?
-
是的,会手动编写
-
好的...我会相应地写一个回复。
标签: jquery jquery-ui jquery-ui-sortable