Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:09:43+00:00 2026-06-09T12:09:43+00:00

I have following elements: <div class=content id=content_1 style=display: none; > <ul class=ad-thumb-list style=width: 473px;

  • 0

I have following elements:

<div class="content" id="content_1" style="display: none; ">

<ul class="ad-thumb-list" style="width: 473px; ">

<li> 
<a href="../images/portfolio/portfolio_1_1.png" class="ad-thumb0 ad-active">
<img src="../images/portfolio/thumbs/thumb_1_1.png"  style="opacity: 1; ">
</a>
</li>

    <li> 
<a href="../images/portfolio/portfolio_1_2.png" class="ad-thumb0">
<img src="../images/portfolio/thumbs/thumb_1_1.png"  style="opacity: 1; ">
</a>
</li>

  <li> 
<a href="../images/portfolio/portfolio_1_3.png" class="ad-thumb0">
<img src="../images/portfolio/thumbs/thumb_1_1.png"  style="opacity: 1; ">
</a>
  </li>         

 </ul>

</div>

I need to get href attribute of first link <a> inside <ul> <li>

I have several this kind of divs, as you can see it has id=’content_1′, so others will have id=’content_2’… and so on.

How can I get href of first a in first li of a called div with jQuery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:09:44+00:00Added an answer on June 9, 2026 at 12:09 pm
    $('#content_1 li:first a').attr('href');
    

    if you have many divs, then:

    $('.content').each( function() {
        $(this).find('li:first a').attr('href');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following elements in a HTML page: <body> <div style=height:100%; width:100%> <div
If I have the following DOM elements <div class=item>content1</div> <div class=item>content2</div> how, using jQuery
I have the following structure: <form> <div class=content> ... </div> <div class=action> <p>Select <a
I have the following markup <div id=hearingSummary> <table class=minitable> ... content removed for brevity
I have the following code: $('<div id=' + id + '><a href=# class=edit>Edit</a> |
I have the following form <form id=myform method=post action=#> <div class=fields> <fieldset class=ui-widget ui-widget-content
I have the following setup: <div>Element with CSS3 animated height change</div> <div><a href=#>Link</a></div> I
I have the following code to toggle elements in a list when the parent
I have the following html code: <div class=trial1> He said all but the three
I want to change the width of elements rendered using following code. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.