javascript - jquery to get href in anchor tag using div/span ID selector and anchor tag class -


hi i'm new jquery wanted seek on getting href attr in anchor tag using div/span id selector , anchor tag class

<span id="view-post-btn"><a href="https://blog.company.com/site1/archives/team/post-1" class="button button-small">view member</a></span>   <div id="preview-action"> <a class="preview button"  href="https://blog.company.com/site1/archives/team/post-1"  target="wp-preview" id="post-preview">preview changes</a> 

thanks :)

try this.

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

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -