?
Solved

jQuery .live

Posted on 2011-03-22
6
Medium Priority
?
454 Views
Last Modified: 2013-11-11
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 ?
0
Comment
Question by:sahanz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 35196133
@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
 
LVL 1

Author Comment

by:sahanz
ID: 35196151
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
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35196156
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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 1

Author Comment

by:sahanz
ID: 35196165
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
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35196169
yes
0
 
LVL 1

Author Closing Comment

by:sahanz
ID: 35196216
Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question