Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery All divs move but need just one to move
    primarykey
    data
    text
    <p>I have this following code below. It has div within one bigger div. I only want the "#set" div to move, not the other divs. But right now the user can move anything that's within a div. How can I make it only move the big div "set"?</p> <p>Header:</p> <pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"&gt;&lt;/script&gt; &lt;style&gt; #set { clear:both; float:left; width: 368px;} p { clear:both; margin:0; padding:1em 0; } &lt;/style&gt; &lt;script&gt; $(function() { $( "#set div" ).draggable({ stack: "#set div", stop: function(event, ui) { var pos_x = ui.offset.left; var pos_y = ui.offset.top; var need = ui.helper.data("need"); console.log(pos_x); console.log(pos_y); console.log(need); //Do the ajax call to the server $.ajax({ type: "POST", url: "updatecoords.php", data: { x: pos_x, y: pos_y, need_id: need} }) } }); }); &lt;/script&gt; </code></pre> <p><br><br><br> Body:</p> <pre><code>&lt;div id="set"&gt; &lt;? $getcoords = mysql_query("SELECT * FROM coords WHERE needid=6"); $rows = mysql_fetch_assoc($getcoords); $x = $rows['x']; $y = $rows['y']; echo " &lt;div style='width: 175px; height: 350px; padding: 0.5em; float: left; margin: 0 10px 10px 0; background: white; position:fixed;left:".$x."px; top:".$y."px;' data-need='6' class='column'&gt; &lt;div class='portlet'&gt; &lt;div class='portlet-header'&gt;Contacts&lt;/div&gt; &lt;div class='portlet-content'&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit&lt;/div&gt; &lt;/div&gt; &lt;div class='portlet'&gt; &lt;div class='portlet-header'&gt;Notes&lt;/div&gt; &lt;div class='portlet-content'&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; "; ?&gt; &lt;/div&gt; </code></pre>
    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.
 

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