从 jQuery Draggable 获取数据
我有一些代码看起来像这样:
<div id="playlist1" class="playlist-row ui-draggable" style="position: relative; ">
<input type="hidden" id="playid" value="48">
<div class="playlist-name">american</div>
<div class="playlist-type">media</div>
<div class="clear"></div>
</div>
看到哪里写着 48 了吗?我怎样才能让该信息在被删除时通过函数?我只是认为隐藏的输入是最好的,但显然不是,因为它不起作用。请记住 48 是一个名为 playlists[j] 的变量。当我现在尝试时,我变得不确定。
I have some code that looks like this:
<div id="playlist1" class="playlist-row ui-draggable" style="position: relative; ">
<input type="hidden" id="playid" value="48">
<div class="playlist-name">american</div>
<div class="playlist-type">media</div>
<div class="clear"></div>
</div>
See where it says 48? How can I get that information to pass through a function upon it being dropped? I just thought a hidden input would be best but clearly not as it isnt working. Keep in mind 48 is a variable called playlists[j]. When I try now I get undefined.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 jQuery Droppable 来实现拖放功能。如果您想在项目出现后运行代码,请点击 drop 事件 的回调函数已被删除。
You should be using the jQuery Droppable for drag-and-drop functionality. Tap into the drop event's callback function if you want to run code once the item has been dropped.