Guest User

Untitled

a guest
Jan 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. $("ul#sidebar_whatever").sortable({
  2. placeholder: "ui-state-highlight",
  3. update: function(event, ui) { //this is where we'll do some updating crap
  4. $("ul#sidebar_whatever").find('li.widget').each(function(){
  5. var val = $(this).find('input.hidden_cool_input').val();// this val will be like "124,1"
  6. var result = val.split(',');
  7. var order = $("ul#sidebar_whatever li.widget").index($(this))//getting the order of the current element in the loop
  8. result[1] = order; // we're reassigning the order
  9. $(this).find('input.hidden_cool_input').val(result.toString());//we're putting the values back in, as "124,0" or "125,3" or whatever.
  10. })
  11. }
  12. });
  13.  
  14.  
  15. /*class ".ui-state-highlight" is a class that will highlight where you are supposed to drag the small widget.*/
Add Comment
Please, Sign In to add comment