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 <alex.bes...@gmail.com> 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
>
> <head>
> <script type="text/javascript">
>  $(document).ready( initialise );
> </script>
> </head>
> <body>
> <div id="droppable"  ></div>
> </body>
>
>
> ---------------------------------------------------------------------
>

Reply via email to