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

  • Home
  • SEARCH
  • 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 6571559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:53:53+00:00 2026-05-25T14:53:53+00:00

I was wondering how can we write a jquery statement to get the max

  • 0

I was wondering how can we write a jquery statement to get the max value of a property of matched elements.

in LINQ we say something like this:

var maxHeight = list.Max(a=> a.Height);

what is the best way to do this in jquery?

as an example let’s say we want to select the max numeric value of all :text elements inside a container:

var allInputs = $("#container :text");
// how to get the max of parseInt(item.val())?

of course having a loop over all elements is an option but I’m curious to know if there is a magic to do with jquery.

Regards.

  • 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-25T14:53:53+00:00Added an answer on May 25, 2026 at 2:53 pm

    Based on all the conversation here and my search in the net we can say that (at this time) there is no robust built-in jquery way to calculate .max() and .min() of a property of elements matching a selector.

    From what Igor suggested I came up with the following two jquery functions which you can add to your project if you need to use .max() and .min() functionalities over and over:

    $.fn.max = function(selector) { 
        return Math.max.apply(null, this.map(function(index, el) { return selector.apply(el); }).get() ); 
    }
    
    $.fn.min = function(selector) { 
        return Math.min.apply(null, this.map(function(index, el) { return selector.apply(el); }).get() );
    }
    
    // Usage:
    
    var maxWidth = $("a").max(function() {return $(this).width(); });
    var minWidth = $("a").min(function() {return $(this).width(); });
    

    See a demo here: http://jsfiddle.net/NF7v7/3/

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

Sidebar

Related Questions

I'm wondering if I can write something like reading app (to turn my Zune
I was wondering if I can write self closing elements like in XHTML in
in jQuery you can write something like $(selector).bind('click', function(e) { // something was true
I'm wondering if I can write is_numeric($action) someway like this: switch ($action): case NULL:
I just wondering, how can write web applications or web pages using LaTeX-styled math?
I'm new to JQuery and was wondering how can I have Changes saved! displayed
I write a jQuery plugin the first time and I'm wondering if there is
In python I can write Hello * 5 and get HelloHelloHelloHelloHello Is there a
I was wondering how can I set a timeout on a socket_read call? The
I'm wondering how can I submit a form via Ajax (using prototype framework) and

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.