View Single Post
Old 10-10-2012, 07:40 PM   PM User | #1
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 960
Thanks: 7
Thanked 100 Times in 100 Posts
WolfShade is an unknown quantity at this point
Question Trying to sort, can't get it to work

Hello, everyone.

I am trying to sort something that isn't starting as an array, but I'm trying to make it into an array, sort it, then put it back as a string.

I have a SELECT tag that allows multiple selections, and an "ADD" button that calls a function that will populate an empty div with the TEXT of whatever was selected, separating each selection with "<br />". So, let's say that three options were highlighted and the add button clicked. The div would then look like this (in code, anyway.)
Code:
<div id="selectedDevs">Jack Black<br />ZZTop<br />Madonna</div>
This much is working great.

But I'm trying to use jQuery to sort the values.

Code:
$('#selectedDevs').html($('#selectedDevs').html().split('<br />').sort().join('<br />'));
It does not change anything. Any suggestions?

Thank you,
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

Last edited by WolfShade; 10-10-2012 at 08:53 PM..
WolfShade is offline   Reply With Quote