SciActive

  • Increase font size
  • Default font size
  • Decrease font size
Home Articles
Articles

jQuery Element Sorting

E-mail Print PDF

I recently needed to sort div elements in the DOM by a timestamp in child divs. After searching for a while and finding no jQuery style solution, I figured out an easy way to do it, the jQuery way. Here is the code:

// Sort by timestamp.
$("#timeclock_edit").prepend($("#timeclock_edit div.element").get().sort(function(a, b){
    return $(a).find(".timestamp").text() - $(b).find(".timestamp").text();
}));

The code grabs an array of DOM elements, sorts it by comparing the text in the timestamp element, then prepends that to the parent div. The way this is coded is not very flexible, but it could be expanded easily.

	

Read 0 Comments... >>
 

Pines Form Styles - Clean CSS Design for XHTML Forms

E-mail Print PDF
User Rating: / 4
PoorBest 

pines-form-exampleCSS form design has been plaguing me for a while now in the Pines project. After searching the web for a couple days trying to find a good CSS design for HTML forms and finding only designs full of hacks/Javascript workarounds or designs too ugly and/or restrictive to be considered, I set out to design my own near flawless, flexible, featureful, standards compliant, and cross-compatible form design to suit the needs of the Pines project. Thus was born, Pines Form. Pines Form is a CSS form design

This design has been tested and works in the following browsers:

  • MS Internet Explorer 5.01, 5.5, 6, 7, 8
  • Mozilla Firefox 1.0, 1.5, 2.0, 3.0, 3.5, 3.6
  • Apple Safari 3, 4
  • Opera 8, 9, 10
  • Google Chrome 2, 3, 4

Read 3 Comments... >>
Read more...
 

Acid Test Results on Popular Browsers

E-mail Print PDF
User Rating: / 46
PoorBest 
This article has been given its own category. Click here.

Read 7 Comments... >>
 

Operation Domination: Windows, Linux, or Macintosh

E-mail Print PDF
User Rating: / 2
PoorBest 

By Hunter Perrin - 5/05/2005

You just got a brand new computer or built one yourself, and now it's time to decide on an operating system. This article will list the good, the bad, and the ugly points of the three major operating systems.


Read 0 Comments... >>
Read more...
 

Developing a Business - 8 Steps for Beginners

E-mail Print PDF
User Rating: / 2
PoorBest 

By Hunter Perrin - 4/19/2005


Read 1 Comments... >>
Read more...
 



Newsflashes

2009-05-14
Dandelion 0.11 Alpha released. This is the second public Dandelion release.
 
2009-04-15
SciActive Forums are now available! Register for free today.
 

Advertisement