Sortable elements not clickable after sorting.

Sortable elements not clickable after sorting.

Hi,

I have an unordered list that is sorted and each of the <li> elements contain divs with a class that is used to assign a click function to the div.

The click function works fine before a list item is moved in the list. Once it has been moved though, the click function does not work anymore.

Any thoughts on what this could be? I've tried a couple of things now and the below is the current state of the code which is producing the error as described above.

Thanks in advance 

  1. $("#sortable").sortable({
  2. placeholder: 'ui-state-highlight',
  3. handle: '.handle',
  4. update: function(event, ui) {
  5. $('.step_list').each(function(index) {
  6. if($(this).attr('order_number') != (index + 1))
  7. {
  8. $.post("ajax_scripts/update_step_order_by_step_id.php", { step_id : $(this).attr('step_id'), order_number : index + 1 }, function(data)
  9. {
  10. if(data == "ERROR")
  11. {
  12. alert("An error occurred");
  13. }
  14. });
  15. }
  16. $.post("ajax_scripts/get_steps_as_unordered_list_by_process_id.php", { process_id : $('#chosen_process option:selected').val() }, function(data)
  17. {
  18. if(data == "ERROR")
  19. {
  20. alert("An error occurred while getting the steps from the database");
  21. }
  22. else
  23. {
  24. $('#sortable').html(data);
  25. }
  26. });
  27. });
  28. },
  29. start: function(e) {
  30. $(".step_list").unbind("click");
  31. },
  32. stop: function(e) {
  33. $(".step_list").click(listClick);
  34. }
  35. });
  36. $("#sortable").disableSelection();
  37. $(".step_list").click(listClick);