I am using Oracle Application Express 4.2 and I have an LOV (List of Values) with a list of flight numbers in a select list. This is a dynamic list of values. I want to add a static value at the top of the select list that says "Upcoming". I also want to add a static value before a specific flight in the select list that says "Past Flights". This way I can distinguish inside the select list which flights are upcoming and which are past flights. My Dynamic LOV is currently called P_100_FLIGHT_LOV2.
I have some JavaScript code below that is executing when the page loads and it is adding "Upcoming" static value to my select list but it adds as the last option. I want this at the top and one in the middle before a specific flight. How can I achieve this using JavaScript?
Here is my JavaScript code below:
var x = document.getElementById("P100_FLIGHT_LOV2");
var option = document.createElement("option");
option.text = "Upcoming";
x.add(option);
Here is the results of this JS code currently:
SPX-14
67P
OA-9
55S
DRAGONX
34R
UPCOMING ----------CURRENTLY AT BOTTOM OF SELECT LIST
The desired result set I want to achieve:
UPCOMING -----------STATIC VALUE
SPX-14
67P
OA-9
PAST FLIGHTS ---------STATIC VALUE
55S
DRAGONX
34R
This is the JavaScript code that I needed to be able to add a static value to my existing LOV. This JavaScript code executes when the page is loaded and added the static value "Past Flights" to the specified option. Thank for the help everyone.
$('#P100_FLIGHT_LOV2 option[value="55S"]').before('<option value="Past">--- Past Flights ---</option>');