JavaScript/jQuery: colMax()
Retrieve max value of a given column of table cells:
function colMax(parent, colIndex) {
var max = 0,
sorted = $(‘td:nth-child(’ + colIndex + ‘)’, parent).get().sort(function(a, b) {
return b - a;
});max = parseInt(sorted.length > 0 ? $(sorted[sorted.length - 1]).text() : 0);
return !isNaN(max) ? max : 0;
}
var max = colMax($(‘.table tbody’)[0], 1);
- Using the cell parent, get and sort the cells.
- Check length and return top cell.
Wednesday Jun 22nd
jQuery 1.6 Released
http://blog.jquery.com/2011/05/03/jquery-16-released/
This includes one of the biggest changes I’ve seen, at least when it comes to having to re-write existing code to support the version upgrade.
Breaking Changes
In the 1.6 release we’ve split apart the handling of DOM attributes and DOM properties into separate methods. The new .prop() method sets or gets properties on DOM elements, and .removeProp() removes properties. In the past, jQuery has not drawn a clear line between properties and attributes. Generally, DOM attributes represent the state of DOM information as retrieved from the document, such as the value attribute in the markup <input type=”text” value=”abc”>. DOM properties represent the dynamic state of the document; for example if the user clicks in the input element above and types def the .prop(“value”) is abcdef but the .attr(“value”) remains abc.
In most cases, the browser treats the attribute value as the starting value for the property, but Boolean attributes such as checked or disabled have unusual semantics.
For example, consider the markup <input type=”checkbox” checked>. The presence of the checked attribute means that the DOM .checked property is true, even though the attribute does not have a value. In the code above, the checked attribute value is an empty string (or undefined if no attribute was specified) but the checked property value is true.
Before jQuery 1.6, .attr(“checked”) returned the Boolean property value (true) but as of jQuery 1.6 it returns the actual value of the attribute (an empty string), which doesn’t change when the user clicks the checkbox to change its state.
There are several alternatives for checking the currently-checked state of a checkbox. The best and most performant is to use the DOM property directly, as in this.checked inside an event handler when this references the element that was clicked. In code that uses jQuery 1.6 or newer, the new method $(this).prop(“checked”) retrieves the same value as this.checked and is relatively fast. Finally, the expression $(this).is(“:checked”) works for all versions of jQuery.


Also…
Ticket #7585 (closed bug: wontfix)
http://bugs.jquery.com/ticket/7585
Wednesday May 4th
Shorthand Javascript & jQuery
I always like use short, swift script lines especially when working with the jQuery object.
$(‘#id’)[doShow ? ‘show’ : ‘hide’]();
Is the same and still just as readable as:
var e = $(‘#id’);
if(doShow)
e.show();
else
e.hide();
You could of course use a toggle() concept in this case but you get the idea.
Wednesday Mar 30th
jQuery 1.5 Beta 1 Released
This is hot. The tweetie bird just delivered.
Happy 5th Birthday to jQuery! jQuery was released on January 14th, 2006 today marks its 5th year of development!
To celebrate the occasion we’re releasing the first beta release of jQuery 1.5! We’re planning on having a final release candidate within 10 days and a final release by the end of the month.
We’d also like to announce three new additions to the jQuery core development team: Julian Aubourg, Colin Snover, and Anton Matzneller. All three of them have been major contributors towards the 1.5 release – providing significant code contributions, bug fixes, and triaging. Please take this opportunity to welcome them aboard!
Additionally we’d like to take take this opportunity to thank all the members of the jQuery community that have helped to get this beta release out – especially all the members of the bug triage team.
We want to encourage everyone from the community to try and get involved in contributing back to jQuery core. We’ve set up a full page of information dedicated towards becoming more involved with the team. The team is here and ready to help you help us!
So without further ado – jQuery 1.5 Beta 1!
http://blog.jquery.com/2011/01/14/jquery-1-5-beta-1-released/
Friday Jan 14th
jQuery Wins the 2010 Open Source JavaScript Libraries Award

*Stands up, applauds*
https://www.packtpub.com/news/jquery-wins-2010-open-source-javascript-libraries-award
Friday Nov 19th