Avatar of sydron
sydronFlag for Australia asked on

jQuery - Get all elements that end with a string

I need to know how to get, via jQuery, all elements in a page ( specifically table tr's ) that end with the string "_trcontent" and hide these elements.

I have tried several site such as http://stackoverflow.com/questions/609382/jquery-selector-id-ends-with which have similar requirements, to no avail.
JavaScript

Avatar of undefined
Last Comment
sydron

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
sydron

I tired that exact line of code and it did not work for me.
hosneylk

how about this..
$('tr[id$="_trcontent"]').hide();

Open in new window

ASKER
sydron

That did not work either.

I call each element directly, say $("#ele_tr_content").hide(); in the same area where i place the suggested code it seems to work.

I can't figure out why this is occurring.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
leakim971

So its tr_content with an underscore

_tr_content
_trcontent
hosneylk

:)
ASKER
sydron

My bad, it is _trcontent, my last post had it wrong.

 
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
hosneylk

very strange... you're sure it's the exact code given above?

I have no idea if this will work but maybe you could give it a try.
$('#tableid tr[id$="_trcontent"]').hide();

Open in new window

ASKER
sydron

Nope didn't work. Not sure whats going on .
hosneylk

can you post the page source here?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
leakim971

can we see the page on the internet?
ASKER
sydron

it is an intranet app. ill try your suggestions on a new clean page and see it if works.  thanks.
ASKER
sydron

I figured it out. It was the version of jQuery i was using. Thanks guys.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.