jQuery .live


i was wondering if there is a way to  assign sortable to $( "#canvas .widget" ) using live method or such ?
$( "#canvas .widget" ).sortable();

Open in new window

Obviously something like this wont work. $( "#canvas .widget" ).live('sortable', function(){});

Any idea ?
Who is Participating?
Gurvinder Pal SinghConnect With a Mentor Commented:
@sahanz: live method is used to event handler binding, much like bind() method only difference being that in live() binding, the event will be attached even if the current selector is available now.

So i need to know why do you want to use the live method. Or precisely, what is the requirement?
sahanzAuthor Commented:
Hi there.

I have this div

<div id="canvas">


from an ajax call I load some divs in to this #canvas and those are having a class called "widget"

so after getting these div.widget s I want them to be sortable.
Gurvinder Pal SinghCommented:
you need to make it sortable every time the ajax load finishes
check this explanation
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

sahanzAuthor Commented:
That's what I thought, the ajax call actually append to #canvas and the ajax load works few times, so that means on each load I have to do the sortable right?
Gurvinder Pal SinghCommented:
sahanzAuthor Commented:
Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.