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: / 2
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 on my own to design a near flawless, flexible, featureful, standards compliant, and cross-compatible form design to suit the needs of the Pines project. I have accomplished my goal, and want to share my work with others so they can benefit from it. This design has been tested and works in the following browsers:

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

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

Acid Test Results on Popular Browsers

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

Read 4 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 0 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