Re: [jQuery] Help with draggable / droppable
Worked ok for me: http://jsbin.com/anure source: http://jsbin.com/anure/edit If you need any more help, note that there's a separate list for jQuery UI: http://groups.google.com/group/jquery-ui - Richard On Thu, Dec 17, 2009 at 1:14 PM, Alex Beston wrote: > Hi there, > > I'm trying to create some words which can be dragged and dropped into a > container. > > I've tried to dynamically create some divs each containing a word, and they > can be dragged okay, but when I try to drop, it isnt recognised. > > thanks in advance, > > Alex > > - > > Heres the code I have so far: > > var these = [ 'red', 'blue', 'green', 'orange', 'white' ]; > > function makeButtons() { > for (i in these) > makeWord(these[i]); > } > > function makeWord(s) { > var e = $(document.createElement('div')); > e.attr('id', s); // make a div with id orange / white / etc > e.append(s); > e.draggable( ); // make this div draggable > $('body').append(e); > } > > function initialise(){ > makeButtons(); > $(function(){ > $("#droppable").droppable({ > drop: function( ) { alert('dropped'); } > }); > }); > } > > // html > > > > $(document).ready( initialise ); > > > > > > > > - >
[jQuery] Help with draggable / droppable
Hi there, I'm trying to create some words which can be dragged and dropped into a container. I've tried to dynamically create some divs each containing a word, and they can be dragged okay, but when I try to drop, it isnt recognised. thanks in advance, Alex - Heres the code I have so far: var these = [ 'red', 'blue', 'green', 'orange', 'white' ]; function makeButtons() { for (i in these) makeWord(these[i]); } function makeWord(s) { var e = $(document.createElement('div')); e.attr('id', s); // make a div with id orange / white / etc e.append(s); e.draggable( ); // make this div draggable $('body').append(e); } function initialise(){ makeButtons(); $(function(){ $("#droppable").droppable({ drop: function( ) { alert('dropped'); } }); }); } // html $(document).ready( initialise ); -
[jQuery] Help with draggable / droppable
I'm wondering if anyone would be kind enough to help me with draggable and droppable. I'm relatively inexperienced in jquery and css. What I want to do is show a list of draggable blocks (referring to the column headings in a CSV file) and to be able to sort them into a set of boxes (fields in a database table). I have a table where the cells contain a set of draggable s and a destination table with droppable s and this bit works fine, I get the event on dropping a div in the table cell. What I can't figure out though is how to move the from the source table cell to the destination table cell. It simply sits where I dropped it on the page. Can anyone please enlighten me on this? thanks Kevin Thorpe