10 examples of 'jquery set select to first option' in JavaScript

Every line of 'jquery set select to first option' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
207private setSingleSelectedOption(option: SelectItem | undefined) {
208 const previous = this.selectedItems.length > 0 ? this.optionsMap[this.selectedItems[0].value] : undefined;
209 this.selected = option ? this.optionsMap[option.value] : undefined;
210 return previous;
211}
229function enableSelectOption($option) {
230
231 // given an already disabled select option, enable it
232
233 $option.removeClass(options.optionDisabledClass)
234 .attr("disabled", false);
235
236 if(options.hideWhenAdded) $option.show();
237 if($.browser.msie) $select.hide().show(); // this forces IE to update display
238}
154selectFirst() {
155 if (super.selectFirst) { super.selectFirst(); }
156 return selectIndex(this, 0);
157}
191function addSelectOption(optionId, disabled) {
192
193 // add an
194 // used only by buildSelect()
195
196 if(disabled == undefined) var disabled = false;
197
198 var $O = $('#' + optionId);
199 var $option = $("")
200 .val($O.val())
201 .attr('rel', optionId);
202
203 if(disabled) disableSelectOption($option);
204
205 $select.append($option);
206}
191function addSelectOption(optionId, disabled) {
192
193 // add an
194 // used only by buildSelect()
195
196 if(disabled == undefined) var disabled = false;
197
198 var jQueryO = jQuery('#' + optionId);
199 var jQueryoption = jQuery("")
200 .val(jQueryO.val())
201 .attr('rel', optionId);
202
203 if(disabled) disableSelectOption(jQueryoption);
204
205 jQueryselect.append(jQueryoption);
206}
53export async function selectOption(value: string, selectField: ElementFinder): Promise {
54 return selectField.$(`option[value="${value}"`).click();
55}
55function setSingleSelectOption(nextSelectedIndex, _isPopoverOpen = true) {
56 set(_state => ({
57 ..._state,
58 activeOption: nextSelectedIndex,
59 selectedOptions: [nextSelectedIndex],
60 isPopoverOpen: _isPopoverOpen,
61 }));
62}
66getSelectedOption(key) {
67 return this.$refs.select2.options[this.selectedIndex()].dataset[key];
68}
81function selectCallback(value, index) {
82 $(".demo .callback_output").prepend("<p>VALUE: " + value + ", INDEX: " + index + "</p>");
83}
1function add_options_to_select($select, opt_list, selected_val) {
2 for (var i = 0; i &lt; opt_list.length; i++) {
3 var $opt = $('

Related snippets