.sort() customized function - Works in IE (surprisingly) but not FF
This is using jQuery v1.7.2.
I have a multiple SELECT that is dynamically populated with names (first last), and a button that will check to see if any of the selected names are already in a DIV - if so, do nothing; if not, add the name(s) to the DIV, each separated by "<BR>", and then sort by last name (split on the "<BR>", sort, join with "<BR>".)
Here is some of my code:
<div id="addedDevs"></div> <!-- If names are already in database, they will be retrieved and populated in here -->
Now for some of the JS code. I'm only posting the one (very long) line that is pertinent. I'll push it across several lines to lessen confusion.
Any idea why it would work in IE, but not FF? I have not tested in Chrome.
A = a.substring(a.indexOf(" ")+1);
B = b.substring(b.indexOf(" ")+1);
return A>B ? 1 : A<B ? -1 : 0 ;
I'm heading home for the weekend, but will be back in the office Monday morning, not-bright-eyed, not-bushy-tailed, but at least alert enough to answer any questions. :)
Have a great weekend, everyone.