I have the following webservice call which I am using to populate a dropdown menu in the UI. I am getting these records in increasing number of createDate by the webservice. Is it possible to reverse the order based on the most recent createDate? I mean in decreasing order of dates.
Taking a closer look at your HTML code, I’m not sure how an anchor link is supposed to work inside of an option tag. That seems weird and strange to me.
Not only should it output the array in reverse order, but it should be more performant, as the script wont need to do an array reverse prior/during the output.
Also, As Paul_W mentioned, if A tags don’t work inside Option tags. If #userSetList is a SELECT tag, and you consider removing the A tag and and adding a value to the option tag.
The reason I have it there is because user will select one thing and inside jquery change function I am storing the user selection into session storage so that I can use it for some webservice call. Please suggest if this isn’t a good option.
Beating added horse here, but another approach would be to se if the API has a sort option (since the service outputs the data from a specific userID, it stands to reason you could pass variables in the query that will tell it to sort by a column in ASC or DESC order)
The reason I have it there is because user will select one thing and inside jquery change function I am storing the user selection into session storage so that I can use it for some webservice call. Please suggest if this isn’t a good option.
just be aware of the following:
option tag will not act as a link from the SELECT menu
the anchor tag wont act as a link OUT of the select menu ( mostly because you have HREF=“#”
the value of the SELECT tag on change will be the text but no tags (as if everything inside the option was run through a strip_tags() function)