views:

66

answers:

2

The title covers most of my question. Instead of:

$('#id').slideUp();

I need to be able to select a particular area tag in an image map in a similar way, by virtue of the string in its href tag. I'm sure this involves the .attr() function but in what way I don't know.
Could a resident genius help me please. Many thanks.

+4  A: 
$('[href="something"]').slideUp();

You can read about other attribute filters at http://docs.jquery.com/Selectors/attributeHas#attribute

meder
Cheers. That look great
As a side note - attribute selectors aren't very speedy - especially in large documents. Its best to define as much as you can about them first, for instance if its going to be an A tag with the "link" class: `$('a.link[href$=info.html]');
gnarf
@gnarf - I was just about to say that it's a good idea to specify an anchor tag in the selector too. There are occasions where not specifying the type of element can cause the jQuery code to not function correctly.
Russ Cam
+1  A: 

Check out the attribute selectors:-

$("[href='whatever']").slideUp();
Gavin Gilmour