Вы не включили все html в вопрос, но я обернул ваш код в table
с помощью tbody
и произвел поиск по всем элементам tr
. После этого вы можете получить доступ к любому свойству с первого tr элемент с getAttribute("key")
var trElements = $('#table-container tbody tr')
const key = trElements[0].getAttribute("key");
console.log(key)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="table-container">
<tbody class="tbody-container">
<tr id="webUIPage_MPD_Downtime_Pareto_Grd_1_0_0000000001" key="DT_002_001" ** parentkey="" class="WebUIGrid_RowClass" level="0" onmouseover="webUIPage_MPD_Downtime_Pareto_Grd_1.rowOnMouseOver("webUIPage_MPD_Downtime_Pareto_Grd_1","webUIPage_MPD_Downtime_Pareto_Grd_1_0_0000000001")"
onmouseout="webUIPage_MPD_Downtime_Pareto_Grd_1.rowOnMouseOut("webUIPage_MPD_Downtime_Pareto_Grd_1","webUIPage_MPD_Downtime_Pareto_Grd_1_0_0000000001")" onclick="webUIPage_MPD_Downtime_Pareto_Grd_1.rowOnClick("webUIPage_MPD_Downtime_Pareto_Grd_1","webUIPage_MPD_Downtime_Pareto_Grd_1_0_0000000001")"
style="background-color: rgb(255, 0, 255); color: black;">
<td class="WebUIGrid_DataCellClass" align="center">
<div style="background-color:#AFD8F8;color:#AFD8F8;overflow:hidden;width:20px;height:20px;margin:3px;">AFD8F8</div>
</td>
<td class="WebUIGrid_DataCellClass" align="left">Machine not running less than 5 minutes</td>
<td class="WebUIGrid_DataCellClass" align="right">51</td>
<td class="WebUIGrid_DataCellClass" align="right">41.7min</td>
</tr>
</tbody>
</table>