Avatar of dlcnet
dlcnet
Flag for United Kingdom of Great Britain and Northern Ireland asked on

get the id inside a HTMLTableRowElement

Hi Experts!

I am using jQuery to get as an array the tr id's for a given filter

var comment = $('tr[id$=comment]').get();
for (var k in comment ) {
	console.log(comment [k]);
}

Open in new window

After executing this code I get in the console the actual <tr> element array like this
<tr style="display: none;" id="[b]name1_comment[/b]">

Open in new window


How one can get the tr id from this?  In jQuery one uses
$(this).attr('id')

Open in new window

in an each, but I would like to know if there is a pure JS way to do it.

Thank you!
JavaScript

Avatar of undefined
Last Comment
Sudhindra A N

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Sudhindra A N

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sudhindra A N

where $('#res') is the another div for displaying results (in my example).
Your help has saved me hundreds of hours of internet surfing.
fblack61