Thanks, it works.

However, it there any way I can design this more nicely so there won't
be unnecessary code repetitions? It just feels a little odd to pass
over all the options again.

On Feb 9, 1:41 am, "Richard D. Worth" <rdwo...@gmail.com> wrote:
> After you add the element to the page, just call .droppable() on it.
>
> $('<div class="usergroup">new user
> group</div>').appendTo('#container_usergroups').css('display',
> 'none').fadeIn('slow').droppable(options);
>
> - Richard
>
> On Sat, Feb 7, 2009 at 12:20 PM, Chris <ch0...@googlemail.com> wrote:
>
> > Hi,
>
> > I am relatively new to developing applications with both javascript
> > and the jquery framework. What I can't figure out is what to do if I
> > dynamically insert something on my page (imagine I click on a button
> > to create a new div-container) and that div should then automatically
> > become a droppable or something.
>
> > Right now, I have the following code loaded on the top of my site.
> > This is not working when I dynamically load the div but of course is
> > when I manually add that markup to the page.
>
> > $('.usergroup').droppable({
> >    accept: function(draggable) {
> >        // imagine certain logic that will return true
> >    },
> >    drop: function(event, ui) {
> >        // do something...
> >    }
> > });
>
> > $('#newgroup').live('click', function() {
> >    $('<div class="usergroup">new user group</div>').appendTo
> > ('#container_usergroups').css('display', 'none').fadeIn('slow');
> > });
>
> > How can I make that div actually be droppable / whatever I want it to
> > be?
>
> > Thanks,
> > Christian

Reply via email to