Every line of 'jquery select add 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.
1 function add_options_to_select($select, opt_list, selected_val) { 2 for (var i = 0; i < opt_list.length; i++) { 3 var $opt = $('
3 function appendOption ($select, option) { 4 $select.append($('') 5 .attr('value', option.id).text(option.text)); 6 }
191 function 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 }
191 function 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 }
45 function addOption(select, name, value) { 46 var newOption = document.createElement("option"); 47 newOption.text = name; 48 newOption.value = value; 49 select.add(newOption); 50 }
207 private 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 }
6 function addNewSelectOption(selectBox) { 7 var opt = document.createElement('option'); 8 opt.value = 'add_new'; 9 opt.innerHTML = '--Add New--'; 10 selectBox.appendChild(opt); 11 }
589 function createSelect(options, fn) { 590 const el = document.createElement('div'); 591 el.innerHTML = ` 592 <h3>${options.name}</h3> 593 594 ${options.options.map(item => ` 595 596 `)} 597 598 `; 599 options.el.appendChild(el); 600 601 const select = el.querySelector('[data-select]'); 602 603 select.addEventListener('change', () => fn(select.value)); 604 }
229 function 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 }
55 addOption(select: HTMLSelectElement, optionText: string) { 56 var option = document.createElement('option'); 57 option.text = optionText; 58 select.options.add(option); 59 }