Skip to content Skip to sidebar Skip to footer

Copying Values Of One Table To Another (how To Convert This Js Function To Jquery)

I am stuck with a small problem here.. What i am trying to do is copy description of id's from one table to another. I have writter half of the javascript and can anybody tell me h

Solution 1:

$(document).ready(function() {
        $('.whipItem', '.data').each(function(index, element) { //for each whipItem in the data table
            var name = $(element).text(); //get the text value
            var desc = $(".itemname[id='" + name + "']").text(); //get the description whose id matches the name in the report table.
            $(element).next().text(desc); //change the value of the next td to the description.
        });
    });

Solution 2:

$(function() {

        $.each($('firstTable td'), function(i) {
            var tableData = $(this);
            $('.secondTable td').eq(i).text(tableData.text());
        });
    });

Post a Comment for "Copying Values Of One Table To Another (how To Convert This Js Function To Jquery)"