mpen
mpen

Reputation: 282885

What does the @ character do in jQuery?

On the selectors page, it says @ is one of the meta-characters. But what does it do?

Upvotes: 9

Views: 136

Answers (3)

Eli Grey
Eli Grey

Reputation: 35860

It was for XPath selectors, of which support for has been dropped.

Upvotes: 1

meder omuraliev
meder omuraliev

Reputation: 186562

It was formerly used to grab an attribute, eg [@href] but it's no longer valid and would throw Syntax error, unrecognized expression: [@href] as of 1.3+

Upvotes: 3

Nick Craver
Nick Craver

Reputation: 630419

It used to be used in the attribute selectors, but that's no longer the case as of jQuery 1.3+. From the attribute selector docs:

Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the “@” symbol from your selectors in order to make them work again.

Upvotes: 7

Related Questions