如何从ui& amp;获得class / id;事件 [英] how to get class/id from ui & event

查看:81
本文介绍了如何从ui& amp;获得class / id;事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得ID&来自 ui&的任何元素的类名事件的任何功能。请参阅下面的清楚了解。

How to get id & class name of any element from ui & event of any function. please see below for clear understanding .

<div class"drag-class" id="drag1"> </div>
 <div class"drag-class" id="drag2"> </div>
      <div class"drop-class" id="drop1"> </div>
      <div class"drop-class" id="drop2"> </div> 

JS:

   $(function(){
     $('.drag-class').draggable();

     $('.drop-class').droppable(function(){

              accept: '.drag-class'.
              drop: function(ui,event){
                /*here i want to know the id of drag-class & drop-class element element*/
                     }              
             });

       });'


推荐答案

来自 docs -


在回调中,$(this)表示可拖动的掉期是
掉落。 ui.draggable表示可拖动。

In the callback, $(this) represents the droppable the draggable is dropped on. ui.draggable represents the draggable.

这篇关于如何从ui&amp; amp;获得class / id;事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆