JSFiddle - React, Tailwind, and code Playground
HTML
<a href='#'>Hello</a>
<a href='#'>Hello 123</a>
<a href='#'>Hello</a>
<a href='#'>Hello very very long</a>
JavaScript
$.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(); });
alert('max width: ' + maxWidth + " min width: " + minWidth);