eggman eggman - 2 years ago 115
Javascript Question

Use jquery to move a td in a tr

I'm looking for a way to dynamically move a

from one place to another (within the same

Please have a look at this fiddle that demonstrates my problem and also some psuedo-code.

I hope to be able to loop through all
´s and check for images in this manner:

$('#original > tbody > tr').each(function(index, value) {
var tdToMove;
// Check if elem has an image as a child
//if so, move it...

Answer Source

You can do it like following.

$('#original > tbody  > tr').each(function(index, value) {
    var td = $('td:first', this);
<script src=""></script>
<table id="original">
      <td><img src="" alt="" width="100" height="65" /></td>
      <td><img src="" alt="" width="100" height="65" /></td>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download