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 6779787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:25:45+00:00 2026-05-26T16:25:45+00:00

how can i get the attribute (href) of a link that is in the

  • 0

how can i get the attribute (href) of a link that is in the same div as another element , see the example below:

  <div id="wrap">
      <div id="column1">
         <div class="desc">Some stuff</div>
         <a href="#1" class="url link1">Link1</a>
      </div>
      <div id="column2">
         <div class="desc2">Another Some stuff</div>
         <a href="#" class="url link2">Link2</a>
      <div>
  </div>


  <div id="wrap">
      <div id="column1">
         <div class="desc">Some stuff</div>
         <a href="#2" class="url link1">Link1</a>
      </div>
      <div id="column2">
         <div class="desc2">Another Some stuff</div>
         <a href="#" class="url link2">Link2</a>
      <div>
  </div>

When i click LINK2 of the first wrap div , jQuery get the href of link1 of the first wrap div.

I know we can get the href using .attr() in jQuery but how can i archive this using 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-05-26T16:25:46+00:00Added an answer on May 26, 2026 at 4:25 pm

    Lets say you get the current <a> element (Link 2) which has been clicked using $(this), you can get Link1 using this:

    alert( $(this).parent().prev().find('a.link1').attr('href') );

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the value of the href attribute in a link to
Is it true that the WebInvoke attribute can take GET as a method? I
I often get confused with the href attribute, the link tag, and the base
Is there any attribute associated with the starting time I can get from the
I have a has_many :through form where I can't get an extra attribute to
How can I get all tr elements without id attribute? <tr id=name>...</tr> <tr>...</tr> <tr>...</tr>
I have an attribute declared on property. How can I get the property name
How can I ignore the attribute error I get when I issue this command?
How can i create an attribute with a namespace? To get the following output?
I just found out that to simulate a click I can call element.InvokeMember(click); where

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.