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
- $("#sortable").sortable({
- placeholder: 'ui-state-highlight',
- handle: '.handle',
- update: function(event, ui) {
- $('.step_list').each(function(index) {
- if($(this).attr('order_number') != (index + 1))
- {
- $.post("ajax_scripts/update_step_order_by_step_id.php", { step_id : $(this).attr('step_id'), order_number : index + 1 }, function(data)
- {
- if(data == "ERROR")
- {
- alert("An error occurred");
- }
- });
- }
-
- $.post("ajax_scripts/get_steps_as_unordered_list_by_process_id.php", { process_id : $('#chosen_process option:selected').val() }, function(data)
- {
- if(data == "ERROR")
- {
- alert("An error occurred while getting the steps from the database");
- }
- else
- {
- $('#sortable').html(data);
- }
- });
- });
- },
- start: function(e) {
- $(".step_list").unbind("click");
- },
- stop: function(e) {
- $(".step_list").click(listClick);
- }
- });
- $("#sortable").disableSelection();
-
- $(".step_list").click(listClick);
-