如何捕获标记<a>

时间:2015-07-22 08:03:40

标签: jquery jquery-plugins

I need to capture all tag in a page with jquery. The page is formed by

<a>A</a>
<a>B</a>

How can I capture this tag? I'm tring with this code :

$(":a").each(function( index ) {

         });

but it doesn't work and it gives me this exception:

Syntax error, unrecognized expression: unsupported pseudo: a

Anyone can help me?

1 个答案:

答案 0 :(得分:1)

如错误所示,使用:您正在选择伪元素。试试这个

$("a").each(function( index ) {

});

查看css selectors