jQuery .live

Hello,

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 ?
LVL 1
sahanzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
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?
0
 
sahanzAuthor Commented:
Hi there.

I have this div

<div id="canvas">

</div>

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.
0
 
Gurvinder Pal SinghCommented:
you need to make it sortable every time the ajax load finishes
check this explanation
http://stackoverflow.com/questions/4323639/jquery-live-and-sortable
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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?
0
 
Gurvinder Pal SinghCommented:
yes
0
 
sahanzAuthor Commented:
Thank you.
0
All Courses

From novice to tech pro — start learning today.