How to block text?

There is a table, in it there is a line
the <tr>
 <td colspan="7" class="hide-tr search-click">Administration</td>
</tr>


Lines with class search-click can be a lot.
When I click on one of the blocks with the class - need to text.
Doing so
$('.search-click').on('click',()=>{
alert($(this).text());
})

But for some reason it displays an empty alert, if instead of this point the class will not what you need(or rather displays of all the blocks). How to be?
April 4th 20 at 00:37
2 answers
April 4th 20 at 00:39
Solution
Use the pointer to function => don't Ask why this works
spoiler
685b316667da950c1a069f50ca91c211.jpg

https://qna.habr.com/answer?answer_id=1401129#answ...

Or write to function () or send (event)=>$(event.target).html()
April 4th 20 at 00:41
The version without jquery:
const allSrchTD = document.querySelectAll('.search-click');
allSrchTD.forEach(td => td.addEventListener('click', event => { alert(event.target.innerText); }));

PS. format code, writing from phone

Find more questions by tags jQuery