Move div to certain table cell according to random number

This question already has an answer here:

  • How to move an element into another element? 12 answers

  • Well, first of all this question has been already asked and answered on SO and table cells are just the same as usual elements :)

    Since you're using jQuery anyway, you can use .detach()

    var element = $('td:eq(0) span').detach();
    $('td:eq(1)').append(element);
    

    Here's a jsfiddle.

    Or, as proposed in this answer, you can use a native js solution.

    链接地址: http://www.djcxy.com/p/42538.html

    上一篇: jQuery将div移入另一个div

    下一篇: 根据随机数将div移到某个表格单元格