Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this:\</p> <p>HTML:</p> <pre><code>&lt;div class="row-fluid"&gt; &lt;div class="drag-option span1 draggable" id="option1"&gt;Option 1&lt;/div&gt; &lt;div class="span2"&gt;&lt;/div&gt; &lt;div class="drag-option span1 draggable" id="option2"&gt;Option 2&lt;/div&gt; &lt;div class="span2"&gt;&lt;/div&gt; &lt;div class="drag-option span1 draggable" id="option3"&gt;Option 3&lt;/div&gt; &lt;div class="span2"&gt;&lt;/div&gt; &lt;div class="drag-option span1 draggable" id="option4"&gt;Option 4&lt;/div&gt; &lt;/div&gt; &lt;div class="row-fluid"&gt; &lt;div class="drop-option droppable span4" data-value="1" readonly&gt;1&lt;/div&gt; &lt;div class="drop-option droppable span4" data-value="2" readonly&gt;2&lt;/div&gt; &lt;div class="drop-option droppable span4" data-value="3" readonly&gt;3&lt;/div&gt; &lt;/div&gt; </code></pre> <p>JS:</p> <pre><code>$('.draggable').draggable({ containment: "#drag-radio" }).css('cursor', 'move'); $('.droppable').droppable({ accept: ".drag-option", hoverClass: "drop-hover", // Make the drag option inherit the drop value drop: function (event, ui) { ui.draggable.data('value', $(this).data('value')); alert(ui.draggable.data('value')); $(this).addClass('dropped'); }, // Remove draggable value and droppable .dropped class out: function (event, ui) { $(".draggable[data-value=" + $(this).data('value') + "]").data('value', ''); $(this).removeClass('dropped'); } }); </code></pre> <p>It uses a dataset attribute instead of the nonstandard value attribute. Then it uses a selector that matches on the dataset attribute to find the draggable that was removed, since there's no <code>ui</code> parameter to say which it was.</p> <p><a href="http://jsfiddle.net/barmar/cFcup/8/" rel="nofollow">FIDDLE</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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