问题
I'm new to jQuery so this is probably simple, but...
If I have this HTML:
<a name="foo">Foo</a>
how can I select the anchor element by its name foo? It doesn't have an id property.
回答1:
You can do it like this:
$('a[name=foo]')
It's called a attribute equals selector.
来源:https://stackoverflow.com/questions/8948758/jquery-selector-anchor-elements-by-name