Solved

jQuery .live

Posted on 2011-03-22
6
432 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
  • 3
  • 3
6 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
@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
Comment Utility
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:gurvinder372
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:sahanz
Comment Utility
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:gurvinder372
Comment Utility
yes
0
 
LVL 1

Author Closing Comment

by:sahanz
Comment Utility
Thank you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now