简体   繁体   English

获取放置我li的ul的ID

[英]Get the id of the ul where my li is placed

I have now a full working Drag'n'Drop Script, but I still want to add a function that the script displays the id of the <ul> where my <li> is placed. 我现在有一个完整的工作Drag'n'Drop脚本,但是我仍然想添加一个函数,该脚本显示<ul>id ,放置我的<li>

I tried a few solutions but none of them worked for me and I think it is because my script is dynamic and not static. 我尝试了一些解决方案,但没有一个对我有用,我认为这是因为我的脚本是动态的而不是静态的。 All in the left div named Teilnehmer are some <li> and they can be dragged into the right div with different street names. 左侧div中名为Teilnehmer都是一些<li> ,可以将它们拖到右侧div中并使用不同的街道名称。 After an <li> is dropped the <li> still remains in the left div, but it should display the id of the <ul> where the <li> is dropped in brackets, eg : Jürgen W.(48) 的后<li>被丢弃的<li>仍停留在左股利,但它应该显示id<ul>其中<li>在括号中,例如滴加: Jürgen W.(48)

Does someone have a solution? 有人有解决方案吗? Here is my fiddle: http://jsfiddle.net/Lf1vvjjb 这是我的小提琴: http : //jsfiddle.net/Lf1vvjjb

尝试这个

$('#li_id').parent()[0]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM