Link to home
Start Free TrialLog in
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.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sydron

ASKER

I tired that exact line of code and it did not work for me.
how about this..
$('tr[id$="_trcontent"]').hide();

Open in new window

Avatar of sydron

ASKER

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.
So its tr_content with an underscore

_tr_content
_trcontent
Avatar of sydron

ASKER

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

 
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

Avatar of sydron

ASKER

Nope didn't work. Not sure whats going on .
can you post the page source here?
can we see the page on the internet?
Avatar of sydron

ASKER

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

ASKER

I figured it out. It was the version of jQuery i was using. Thanks guys.