Table tr td n-th-child with jQuery 'Hide/Show' magic

 

$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');
            
            if (i > 0) {
                $(this).hide();
                $("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr td:nth-child(3)').hide();
                $(this).parent('tr td:nth-child(4)').hide();
                $(this).parent('tr td:nth-child(5)').hide();
                $(this).parent('tr td:nth-child(6)').hide();
                $(this).parent('tr td:nth-child(7)').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});


$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').find('td:nth-child(3)').hide();
                $(this).parent('tr').find('td:nth-child(4)').hide();
                $(this).parent('tr').find('td:nth-child(5)').hide();
                $(this).parent('tr').find('td:nth-child(6)').hide();
                $(this).parent('tr').find('td:nth-child(7)').hide();
----------
$('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
    var getcurrent = $(this).text();
    var i = 0;
    $('#SktchBlkDtlsTabel tr td:nth-child(2)').each(function () {
        if ($(this).text() == getcurrent) {
            $(this).css('color', 'red');

            if (i > 0) {
                $(this).parent('tr').find('td:nth-child(3)').hide();
                $(this).parent('tr').find('td:nth-child(4)').hide();
                $(this).parent('tr').find('td:nth-child(5)').hide();
                $(this).parent('tr').find('td:nth-child(6)').hide();
                $(this).parent('tr').find('td:nth-child(7)').hide();
                $(this).parent('tr').find('td:nth-child(8)').hide();
                $(this).parent('tr').find('td:nth-child(9)').hide();
                $(this).parent('tr').find('td:nth-child(10)').hide();
                //$("#SktchBlkDtlsTabel").find("tr:contains(" + getcurrent + ")").hide();
                //$(this).parent.parent.find("tr:contains(" + getcurrent + ")").hide();
            }
            i = i + 1;
        }
    });
});






Change Gridview Header Text


$('#ContentPlaceHolder1_gvDashBoard tbody tr th:nth-child(1)').html("NewText");

Social Media