开发者

how to get attribute from any selected object in jquery

开发者 https://www.devze.com 2022-12-08 08:23 出处:网络
for example <a href=\"http://stackoverflow.com\" class=\"selected\">stackoverflow</a> my jquery is h开发者_Go百科ere

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

精彩评论

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