在拖动a到Trash时使用Jquery的长度是多少 [英] on drag a to Trash what is the length of using Jquery
问题描述
我正在使用可排序的连接列表。
场景:
我有一个下拉按钮和一个按钮。选择一个值后,我点击按钮并将其值添加到我的可排序列表中。我可以拥有我想要的多个项目,我可以添加到列表没有问题。直到这里工作正常
我的问题是:
拖动任何物品之后我有一个垃圾桶ul并放弃垃圾。 (这部分也很好)。
拖到废纸篓:我需要弄清楚UI的大小。
所以用简单的话说将li中的一个拖到垃圾桶后我需要''ul''的长度
任何帮助或想法?
#TDCER是''ul''的id。
I am working of a sortable conected list .
scenario :
I have a drop down and a button. after selecting a value , I click on button and its add value to my Sortable list. I can have as many item i want , i can add to list no problem . Till here work fine
My problem is :
I have a Trash , after dragging any item from ul and drop on trash. (This part also work fine) .
On drag to Trash: I need to figure out size of UI.
So in simple words i need the length of ''ul'' after drag one of the ''li'' to trash
Any help or idea ?
"#TDCER" is the id of the ''ul''.
$("#trash").droppable({
drop: function(ev, ui) {
var $elem = $('#tdcer');
var $val = ($elem.length);
alert($val);
// Following part remove the element of the <ul> and its work good
ui.draggable.remove();
}
});
注意:
当我的页面加载''ul''长度为0时。以上所有过程都没有页面刷新或重新加载。
NOTE:
When my page load ''ul'' length is 0 . All the above process is without page refresh or reload.
推荐答案
( #trash)。droppable({
drop:function(ev,ui){
var
("#trash").droppable({ drop: function(ev, ui) { var
elem =
(' #tdcer');
var
这篇关于在拖动a到Trash时使用Jquery的长度是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!