new

by klbaiju

HTML

<table id="GridView3" cellspacing="0" border="1" border-collapse:collapse; rules="All" ;>
<tbody>
<tr>
<th>ID </th>
<th>01 </th>
<th>02 </th>
<th>03 </th>
<th>04 </th>
<th>05 </th>
<th>06 </th>
<th>07 </th>
</tr>
<tr><td>101</td><td  style="background-color: Orchid;">
<a  class="anchor3" href="#">B</a>
</td><td style="background-color: rgb(255, 0, 0);">
<a class="anchor3" href="#">B </a>
</td><td style="background-color: rgb(255, 0, 0);">
<a class="anchor3" href="#">B </a>
</td><td style="background-color: rgb(255, 0, 0);">
<a class="anchor3" href="#">B </a>
</td><td  style="background-color: Orchid;">
<a  class="anchor3" href="#">B</a>
</td><td style="background-color: rgb(255, 0, 0);">
<a class="anchor3" href="#">B </a>
</td><td style="background-color: rgb(255, 0, 0);">
<a class="anchor3" href="#">B </a>
</td></tr>
</tbody>
</table>

JavaScript

$(document).ready(function () {

            $('body').on('click', '.anchor3', function () {
                var bcolor = $(this).parent().css("background-color");
                console.log(bcolor);
                $("a.anchor3:contains('B')").each(function () {
                    var pcolor = $(this).parent().css("background-color");
                    console.log(pcolor);
                    if (pcolor != "rgb(218, 112, 214)") {
                        $(this).parent().css("background-color", "red");
                    }
                    else {

                        $(this).parent().css("background-color", "Orchid");
                    }
                });
                $("a.anchor3:contains('b')").parent().css('background-color', 'LightGrey');
                $(this).parent().css('background-color', 'Grey');



            });
        });