0
我试图点击一个项目,并让该项目跳转到下一列。截至目前,当我点击该项目时,该项目溢出,到其他列。jQuery parent.sibling逻辑
这是代码。
我想只将项目移动到下一列,然后移到下一列。
'use strict';
$(document).ready(init);
function init(){
\t $('#groupOne').on('click', '.item', clickHolder);
\t $('#groupOne').on('click', '.item', clickCup);
}
function clickHolder(event){
\t $('.selected').appendTo($(this));
\t $('.selected').removeClass('.selected');
}
function clickCup(){
\t var $this = $(this);
\t \t $this.addClass('.selected');
\t var $sibling = $this.parents().siblings();
\t var $detached = $this.detach(); \t
\t \t $sibling.append($detached); \t
}
\t <div class="topRow">
\t \t <input type="text">
\t \t <input type="number">
\t \t <button>Add</button>
\t </div>
\t <table id="groupOne">
\t \t <tr>
\t \t \t <th>Item</th>
\t \t \t <th>Price</th>
\t \t </tr>
\t \t <tr class="item">
\t \t \t <td>Banana</td>
\t \t \t <td>14.99</td>
\t \t </tr>
\t \t <tr class="item">
\t \t \t <td>Apple</td>
\t \t \t <td>5.99</td>
\t \t </tr>
\t \t <tr class="item">
\t \t \t <td>Tomato</td>
\t \t \t <td>8.99</td>
\t \t </tr>
\t </table>
\t <table id="groupTwo"></table>
\t <table id="groupThree"></table>
\t <table id=id="groupFour"></table>
\t <script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
\t <script src="main.js"></script>
你想要什么exacly办? – madalinivascu
您向同一个dom对象出价2个事件 – madalinivascu