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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:44:19+00:00 2026-05-28T19:44:19+00:00

I have: <a rel=9>Link 1</a> <a rel=6>Link 2</a> <a rel=3>Link 3</a> <a rel=21>Link 4</a>

  • 0

I have:

<a rel="9">Link 1</a>
<a rel="6">Link 2</a>
<a rel="3">Link 3</a>
<a rel="21">Link 4</a>

I want to trigger a click on the link with the highest ‘rel’ value. What is the most efficient way to write this?

  • 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-28T19:44:20+00:00Added an answer on May 28, 2026 at 7:44 pm

    Try this.

    var max = 0, index = 0;
    $('a[rel]').each(function(i){
       if(parseInt($(this).attr('rel'), 10) > max){
          max = parseInt($(this).attr('rel'), 10);
          index = i;
       }
    }).eq(index).trigger('click');
    

    Demo

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

Sidebar

Related Questions

I have this code: $('.user_info').click(function(){ var pos = $(this).offset(); rel_value = $(this).attr('rel'); $('#' +
I have many link like this with different rel attributes <a href=# class=buy rel=WVSEU1Y>buy</a>
I have a link with a 'rel' attribute: <a href=# rel=music>Click</a> <p></p> I have
I have this link: <%=link_to 'Free Trial', '/sign_up?partial=1', :rel => #signup, :class => sign_up_button%>
I have the following code: $('#main-nav a').mouseover(function() { var name = $(this).attr(rel); $(#subnav ul.
I have a set of random links, like this: <a rel=foo> ... </a> ...
I have a link with the id: nyhedsklik I this function that gets triggered
I want to read this file:- http://www.somehost.com/products/, A0,D1,L0,T0 http://www.somehost.com/news/rel, A1,D0,L1,T0 http://istor.somehost.com, A0, D1, L0,
I have this link that creates a few div's in which a form is
I have two sets of elements with (sometimes) corresponding rel and id attributes: <a

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.