最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery to get href in anchor tag using divspan ID selector and anchor tag class - Stack Overflow

programmeradmin0浏览0评论

Hi I'm new to jquery I just wanted to seek some help on getting the href attr in anchor tag using div/span ID selector and anchor tag class

<span id="view-post-btn"><a href="" class="button button-small">View Member</a></span>


<div id="preview-action">
<a class="preview button"  href=""  target="wp-preview" id="post-preview">Preview Changes</a>

Thanks :)

Hi I'm new to jquery I just wanted to seek some help on getting the href attr in anchor tag using div/span ID selector and anchor tag class

<span id="view-post-btn"><a href="https://blog.pany./site1/archives/team/post-1" class="button button-small">View Member</a></span>


<div id="preview-action">
<a class="preview button"  href="https://blog.pany./site1/archives/team/post-1"  target="wp-preview" id="post-preview">Preview Changes</a>

Thanks :)

Share Improve this question asked Apr 10, 2014 at 7:19 user2450064user2450064 1131 gold badge5 silver badges15 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

try

$('#view-post-btn').find('a').attr('href');
$('#preview-action').find('a').attr('href');

try this.

$('#view-post-btn').find('a.button').attr('href');
$('#preview-action').find('a.preview').attr('href');
发布评论

评论列表(0)

  1. 暂无评论