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