Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery List Item Links Lost When Dragged and Dropped
    primarykey
    data
    text
    <p>The following code drags and drops a list item into a box. However, when I put links in as list items, the items no longer appear as links once dragged and dropped (they simply appear as text). Please help. This is due for a project very soon. I would be very gratefuly.</p> <p>///// JAVASCRIPT-------------------------------------------------------------</p> <pre><code>a = 0; num = 1; $(document).ready(function() { $('li').draggable({ containment: 'document', revert: true, start: function() { contents = $(this).text(); } }); $('#list').droppable({ hoverClass: 'border', accept: '.item', drop: function() { if(a % 4 == 0) { $('#list').append('&lt;br / &gt;'); } $('#list').append(num + '. ' + contents + '&amp;nbsp;' + '&amp;nbsp;' + '&amp;nbsp;' + '&amp;nbsp;'); a = a + 1; num = num + 1; } }); }); </code></pre> <p>///// HTML--------------------------------------------------------------------------- JQuery Tutorial </p> <pre><code>&lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;td&gt; &lt;tr&gt; Create Your Own Playlist &lt;br /&gt; Simply Drag and Drop the Lessons You'd Like to View &lt;/tr&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Agility&lt;/li&gt; &lt;li class="item"&gt;Broadband&lt;/li&gt; &lt;li class="item"&gt;Cloud&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Flexibility&lt;/li&gt; &lt;li class="item"&gt;Hybrid&lt;/li&gt; &lt;li class="item"&gt;Interoperability&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Community&lt;/li&gt; &lt;li class="item"&gt;Portability&lt;/li&gt; &lt;li class="item"&gt;Elasticity&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Infrastructure&lt;/li&gt; &lt;li class="item"&gt;Migration&lt;/li&gt; &lt;li class="item"&gt;Multi-Tenancy&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Navigation&lt;/li&gt; &lt;li class="item"&gt;Optimization&lt;/li&gt; &lt;li class="item"&gt;Private&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Provisioning&lt;/li&gt; &lt;li class="item"&gt;Public&lt;/li&gt; &lt;li class="item"&gt;Risk&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Security&lt;/li&gt; &lt;li class="item"&gt;Smart Phones&lt;/li&gt; &lt;li class="item"&gt;Social Media&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;li class="item"&gt;Standards&lt;/li&gt; &lt;li class="item"&gt;Storage&lt;/li&gt; &lt;li class="item"&gt;Virtual Machines&lt;/li&gt; &lt;li class="item"&gt; &lt;a href="facebook.com"&gt;Link text&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; &lt;/table&gt; &lt;div id="list"&gt;&lt;/div&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>///// CSS--------------------------------------------------------------------------------- @charset "utf-8"; /* CSS Document */</p> <pre><code>ul { width: 100px; padding: 0px; list-style: none; } #list { width: 800px; height: 150px; background-color: #f0f0f0; border: 1px solid #000; overflow: auto; } #list.border { border-width: 2px; } </code></pre>
    singulars
    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.
 

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