質問するログイン新規登録

質問編集履歴

2

追記

2017/05/23 07:21

投稿

ssk
ssk

スコア332

title CHANGED
File without changes
body CHANGED
@@ -50,15 +50,15 @@
50
50
  要素は非表示になるのですが、``#sortable``に要素が追加されません。
51
51
  ```javascript
52
52
  $(function() {
53
-
54
53
  $('#unList li').on('click',function(){
55
- $(this).hide();
54
+ $(this).remove();
56
- $(this).appendTo('#sortable');
55
+ $('#sortable').append($(this).clone().addClass("ui-sortable-handle"));
57
56
  });
58
57
 
59
58
  $("#sortable li").on('click',function(){
60
- $(this).hide();
59
+ $(this).remove();
61
- $(this).appendTo('#unList');
60
+ //$(this).appendTo('#unList');
61
+ $('#unList').append($(this).clone().removeClass("ui-sortable-handle"));
62
62
  });
63
63
  });
64
64
  ```

1

追記

2017/05/23 07:21

投稿

ssk
ssk

スコア332

title CHANGED
File without changes
body CHANGED
@@ -43,4 +43,22 @@
43
43
  $(this).appendTo('#sortable');
44
44
  });
45
45
  });
46
+ ```
47
+
48
+ ###追記
49
+ 以下のようなコードにして試してみました。
50
+ 要素は非表示になるのですが、``#sortable``に要素が追加されません。
51
+ ```javascript
52
+ $(function() {
53
+
54
+ $('#unList li').on('click',function(){
55
+ $(this).hide();
56
+ $(this).appendTo('#sortable');
57
+ });
58
+
59
+ $("#sortable li").on('click',function(){
60
+ $(this).hide();
61
+ $(this).appendTo('#unList');
62
+ });
63
+ });
46
64
  ```