I can't seem to get the proper text value or index of a select field in Forms. As always with Javascript there is 10 different ways to do the same thing, but I am using every example I can find on Google and it always returns the number 1 for both the first and second value.
So here is what I am currently using
var selection = $(this).find('.points option:selected').val(); alert(selection);
or
var selection = $(this).find('.points select').val();
They both return incorrect values. The drop downs are set to the option "Select" which is the first index. The value returned in the alert is "1" when the drop down is showing "Select"
The second option in the drop down is "1" and when they choose "1" the alert also says "1". How can both "Select" and "1" = "1"?
If you select "2" then it returns "2", which makes sense.
The points inputs are just basic drop down fields being populated like this
points.empty().append('<option value="1">Select</option>'); for (j = 1; j <= max; j++) { points.append('<option value="'+j+'">'+j+'</option>'); }