Computer Science, asked by kailashkothiyal7958, 11 months ago

What is change all onption??

Answers

Answered by uniqueboypaul
10

Explanation:

need to change the text in all <option ...> ... </option> elements of a dropdown that uses jQuery SelectPicker. None of the values should be effected.

Initially, when the options are populated there is a placeholder of XX in the option text. For example:

All of the option texts have this similar format. I need to iterate through each option text, change the XX value and save the change.

The change is dependent on another control which could change back and forth, but the XX is obviously gone after the first change. So I thought I could save the initial <select> in document.ready:

_savedSelect = $('#mySelect');

At this point I can iterate through _savedSelect when needed, read the default texts containing the XX placeholders, modify each and then save them to the <option> elements of the actual <select>.

Similar questions