javascript - Drop elements into text box using jQuery -


When I leave one elements in the text box, it arranges in the middle ... initially this element How to organize? I use the Foundation

Can there be a problem?

My jQuery:

  & lt; Script type = "text / javascript" & gt; Function ($ ("(# dragdiv")) {$ ("(# dragdiv li)") {{accessory: "clone", cursor: "move", back: "invalid"}); InitDroppable ($ ("# dropdiv")); Function initDroppable {$ elements} {$ elements.droppable ({activeClass: "ui-state-default", hoverClass: "ui-drop-hover", accept: "no (.ui-sortable-helper)", over : Function ($ this.val () == '') {$ This.val (ui.draggable.text ());} and {$ this.val ($ this.val () + "," + ui. Draggable.text ());}}});}}}; & Lt; / Script & gt; & Lt; Style type = "text / css" & gt; #dropdiv ul {Display: Inline-Block! Important; Swim left; } #dragdiv ul {margin-top: 20px; } & Lt; / Style & gt;  

HTML:

  & lt; P & gt; & Lt; B & gt; Tags: & lt; / B & gt; & Lt; / P & gt; & Lt; Input id = "dropdiv" type = "text" style = "overflow: scroll; width: 605" /> & Lt; Div id = "dragdiv" & gt; & Lt ;? Php if ($ tag):? & Gt; & Lt; Ul id = "all items" & gt; & Lt ;? Php foreach ($ tag as $ t):? & Gt; & Lt; Li id = "node" runat = "server" & gt; & Lt ;? Php echo $ t ['name']? & Gt; & Lt; / Li & gt; & Lt ;? Php endforeach; ? & Gt; & Lt; / Ul & gt; & Lt ;? Php endif; ? & Gt; & Lt; / Div & gt;  

How to do this? Please help me ..... please

  & lt; P & gt; & Lt; B & gt; Tagore: & lt; / B & gt; & Lt; / P & gt; & Lt; Input id = "dropdiv" type = "text" style = "width: 605" /> & Lt; Div id = "dragdiv" & gt; & Lt; Ul id = "all items" & gt; & Lt; Li id = "node" runat = "server" & gt; The first tag & lt; / Li & gt; & Lt; Li id = "node" runat = "server" & gt; The second tag & lt; / Li & gt; & Lt; Li id = "node" runat = "server" & gt; The third tag & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;    

You get each li elements, around text, and they Also being copied.

Change the PHP so that there are no tabs ...

  & lt; Li id = "node" runat = "server" & gt; & Lt ;? Php echo $ t ['name']? & Gt; & Lt; / Li & gt; Alternatively, change the  drop  function to 

  drop: function (event, UI) { Var $ this = $ (this); If ($ this.val () == '') {$ this.val (ui.draggable.text () .tim ()); } And ($ this.val ($ this.val () + "," + ui.draggable.text (). Trim ());}}  

Notice I have been prominent and backward trim () has been added to get rid of white space.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -