Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1125
  • Last Modified:

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.
0
sydron
Asked:
sydron
  • 6
  • 4
  • 3
1 Solution
 
leakim971PluritechnicianCommented:
>Get all elements that end with a string.
<< all element >> ? You mean the id end

Use end selector : http://api.jquery.com/attribute-ends-with-selector/


jQuery('[id$="_trcontent"]').hide();

Open in new window

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

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
sydronAuthor Commented:
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.
0
 
leakim971PluritechnicianCommented:
So its tr_content with an underscore

_tr_content
_trcontent
0
 
hosneylkCommented:
:)
0
 
sydronAuthor Commented:
My bad, it is _trcontent, my last post had it wrong.

 
0
 
hosneylkCommented:
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

0
 
sydronAuthor Commented:
Nope didn't work. Not sure whats going on .
0
 
hosneylkCommented:
can you post the page source here?
0
 
leakim971PluritechnicianCommented:
can we see the page on the internet?
0
 
sydronAuthor Commented:
it is an intranet app. ill try your suggestions on a new clean page and see it if works.  thanks.
0
 
sydronAuthor Commented:
I figured it out. It was the version of jQuery i was using. Thanks guys.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now