Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you can do this way, for example</p> <pre><code> &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;New Web Project&lt;/title&gt; &lt;script src="jquery-1.5.min.js"&gt;&lt;/script&gt; &lt;script src="jquery-ui-1.8.16.custom.min.js"&gt;&lt;/script&gt; &lt;style&gt; body{ margin:0; padding:0; } .box{ display:block; width:100px; height:50px; background-color:green; border:1px solid #000; } #drop{ position:absolute; top:220px; left:220px; width:250px; height:250px; border:1px solid red; background:yellow; z-index:1; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#boxBesar p').each(function(index,element){ $('#boxBesar p:eq('+index+')').css({ 'border':'1px solid #000', 'width':'100px', 'height':'100px', 'position':'absolute', 'left':(index*200)+10, 'z-index':index+2, 'color':'black', 'text-align':'center', 'background':'#ccc' }) }) .draggable({ revert:true }) $('#drop').droppable({ drop:dropIt }) function dropIt(event,ui){ //get an id **var id=ui.draggable.attr('id')** //test an id name alert(id) } }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="boxBesar"&gt; &lt;p id="b1"&gt;Box 1&lt;/p&gt; &lt;p id="b2"&gt;Box 2&lt;/p&gt; &lt;/div&gt; &lt;div id="parent"&gt; &lt;div id="drop" &gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload