开发者

how to get attribute from any selected object in jquery

for example

<a href="http://stackoverflow.com" class="selected">stackoverflow</a>

my jquery is h开发者_Go百科ere

alert($('.selected').attr('href'));

but this don't work

How to get attribute from selected object?


The anchor tag should have an href attribute, not src.


You say scr in the anchor tag and src in the jquery expression. Also anchors have href not src attributes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜