eozzy
eozzy

Reputation: 68680

Find and Hide element (jQuery)

<a href="#">Hide Me</a>

How do I find a link with text "hide" in it. I know how to find links by attributes but can't figure out how to find link by its text.

Upvotes: 1

Views: 1365

Answers (2)

user57508
user57508

Reputation:

$('a:contains("Hide")');

see this post
see jQuery docu

Upvotes: 1

David Hedlund
David Hedlund

Reputation: 129792

$('a:contains(Hide)')

Note that contains is case sensitive.

$('a:contains(Hide)').click(function() { $(this).hide() });

Upvotes: 3

Related Questions