5

Stuck with this issue for the past 2 days :-( Trying to create draggable sortable list with dynamically added groups. Was able to create containers, but divs cant be dropped to these containers.. Can somebody point out where I am doing it wrong, I know that it has to be assigned to a variable, even tried that, still now working.. Fiddle is as follows..

http://jsfiddle.net/Sullan/mLHJW/

0

3 Answers 3

5

if dynmmcally created elements not working try using on in jquery version 1.7 . if you are using less than that , like 1.6 , 1.5 or something you can use live

example

$("p").on("click", function(){
alert( $(this).text() );
});

or

$("p").live("click", function(){
alert( $(this).text() );
});

insted of

$("p").click( function(){
alert( $(this).text() );
});

on ad live wil be added to the dynamically created elements

http://api.jquery.com/on/

http://api.jquery.com/live/

Sign up to request clarification or add additional context in comments.

Comments

5

Just repeated the call within the button click.. not sure whether its the right way.. but works out fine...

http://jsfiddle.net/Sullan/mLHJW/1/

Comments

2

try using this plugin http://docs.jquery.com/Plugins/livequery#Download

once you include it just use it like this (example from your code):

var test = $('ul.itemsList').livequery(function(){
                    $(this).sortable({
                        connectWith: $('.itemsList, .itemsList li')
                    });
               });  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.