javascript - jQuery live and sortable -


i have following static html:

<ul id="mylist">     <li id="li_10"><a href="10">item 10</a></li>     <li id="li_20"><a href="20">item 20</a></li>     <li id="li_30"><a href="30">item 30</a></li>     <li id="li_40"><a href="40">item 40</a></li>     <li id="li_50"><a href="50">item 50</a></li> </ul> 

i have following jquery:

<script>     $( document ).ready( function() {          $("#mylist").sortable(             {axis:"y"}         );     }); </script> 

this works perfectly, stops working use jquery/ajax generate above html. assuming need use "live" function in jquery sortable section. can me implement this?

.live() event based, can't use plugins this. can call code when ajax call finishes, example:

$.ajax({  //options...   success: function(data) {     //create ul     $("#mylist").sortable({axis:"y"});   } }); 

the same goes short forms of $.ajax(), example:

$("#mylist").load("pagethatgivesthelielementgoodness.htm", function() {   $(this).sortable({axis:"y"}); }) 

Comments

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -