How do multiple tr, in table in HTML change color by clicking on the text of td in tr

Code

<table>
    <tr id="1">
        <td class="td1">1</td>
        <td class="td2">2</td>
        <td class="td3">3</td>
    </tr>
    <tr id="2">
        <td class="td1">1</td>
        <td class="td2">2</td>
        <td class="td3">3</td>
    </tr>
    <tr id="3">
        <td class="td1">1</td>
        <td class="td2">2</td>
        <td class="td3">3</td>
    </tr>
</table>

if you click on the table in the above format, you want to click on a tr to change the color of the text in the current td, and click on another tr to change the color of the td in the newly clicked tr, and the original one will change back to the previous color. I tried jQuery for a long time, but I didn"t get it done. I hope God will give me some advice-sharp-sharp-sharp problem description

May.22,2021

like this?

<script>
    $('table tr').click(function () {
        $(this).find('td').addClass('redcolor');
        $(this).siblings().find('td').removeClass('redcolor');
    })
</script>
<style>
    .redcolor{
        color: red
    }
</style>
Menu