###前提・実現したいこと
いつもお世話になっております。
以前こちらで質問させていただきました、「複数のtableを移動させて、並び順を変える」ソースコードの書き方の質問の続きです。
現状並び替えるところまでは成功しておりますが、その結果エラーが出ており、各tableタグに画像を添付できない状況にあります。
目的は、そのエラーを消して画像を添付できるようにすることです。
ご教授いただけないでしょうか。
宜しくお願い致します。
###該当のソースコード
HTML
<div id="ABC"> <? for($i = 1; $i; $i++): ?> <table class="image mgn0"> <tbody> <tr style="background-color: #ffffff"> <th style="width: 30px; cursor: move;"> <div></div> </th> <td> <div class="pos_relative"> <p></p> <div></div> </div> <div class="image_edit_area clearfix"> <p></p> </div> </td> </tr> </tbody> </table> <? endfor ?> </div>
Jquery
$(function() { $('#ABC').selectable({ cancel: '.sort-handle, .ui-selected', filter: '> table' }).sortable({ axis: 'y', handle: 'th,.daragSort', sort: function(event, ui) { $(ui.item).trigger('mouseover'); }, stop: function(event, ui ){ $(ui.item).trigger('mouseout'); }, }); $('#imageEdit table.image').hover(function() { $(this).find('.dragable').css('display', 'block'); }, function() { $(this).find('.dragable').css('display', 'none'); }); });
###表示されるエラー
Uncaught TypeError: Cannot read property 'insertBefore' of null at a.(anonymous function).(anonymous function)._rearrange (http://local.lab3.ielove.jp/js/jquery-ui-1.8.17.custom.min.js?20120828:102:20652) at a.(anonymous function).(anonymous function)._mouseDrag (http://local.lab3.ielove.jp/js/jquery-ui-1.8.17.custom.min.js?20120828:102:5683) at a.(anonymous function).(anonymous function)._mouseMove (http://local.lab3.ielove.jp/js/jquery-ui-1.8.17.custom.min.js?20120828:28:1632) at HTMLDocument._mouseMoveDelegate (http://local.lab3.ielove.jp/js/jquery-ui-1.8.17.custom.min.js?20120828:28:1267) at HTMLDocument.dispatch (http://local.lab3.ielove.jp/js/jquery-1.7.1.min.js:3:4351) at HTMLDocument.i (http://local.lab3.ielove.jp/js/jquery-1.7.1.min.js:3:328) ※insertBeforeの該当箇所 _rearrange: function(a, b, c, d) { c ? c[0].appendChild(this.placeholder[0]) : b.item[0].parentNode.insertBefore(this.placeholder[0], this.direction == "down" ? b.item[0] : b.item[0].nextSibling), this.counter = this.counter ? ++this.counter : 1; var e = this , f = this.counter; window.setTimeout(function() { f == e.counter && e.refreshPositions(!d) }, 0) },
tableタグを複数選択し、下げたときにエラーが発生します。
宜しくお願い致します。
あなたの回答
tips
プレビュー