I'm in trouble here... I am having this strange output from a dynamic form I'm building at the moment.
Basically I have a JavaScript completing a form while the user selects an option, starting with 'Soil type' » 'Slope angle' » 'Water Speed'. Now, 'Water Speed' has decimal values, and they all add up to the dropdown selection fine, but completely out of order.
My selection list is looking like:
1, 2, 3, 1.5, 2.5
Instead of:
1, 1.5, 2, 2.5, 3
I tried converting all of them to float values with no luck...What's bugging me, is that the Object and it's propreties are declared in the correct order and console.log() outputs them fine as well, so I am curious to see if this is simply HTML fault and if there's any workaround.
By the way, the way I add them to the select tag is:
for(speed in obj[speeds]){
$('<option value=\"'+speed+'\">'+speed+'</option>').appendTo('select[name=waterspeed]');
}
Thanks in advance!
speeds, and how you are trying to sort them?