Every line of 'jquery add option to select' 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 }
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 }
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 }
95 function populateSelectOptions() { 96 var $select = $('#interactive-image-bit-comparer-selected-image'); 97 for (var i = 0; i < ImageBitComparer.INITAL_IMAGES.length; i++) { 98 var file = ImageBitComparer.INITAL_IMAGES[i][0]; 99 var text = ImageBitComparer.INITAL_IMAGES[i][1]; 100 $select.append($('
55 addOption(select: HTMLSelectElement, optionText: string) { 56 var option = document.createElement('option'); 57 option.text = optionText; 58 select.options.add(option); 59 }
550 function createSelectBox(options, selected) { 551 var select = $(''); 552 $.each(options, function(k,v) { 553 select.append($("").attr('value', k).attr('selected', selected==k ? 'selected' :'')); 554 }); 555 return select; 556 }
187 function addSelectedOptions(selector, container) { 188 var selectedOptions = []; 189 var optionSelector = selector.data('config').noEmptyOption ? 'option:selected' : 'option[data-selected=true]'; 190 $.each($(selector).find(optionSelector), function(i, option) { 191 selectedOptions.push(convertOptionToJson(option)); 192 if (selector.data('config').singleSelect) return false; 193 return true; 194 }); 195 196 if (!selectedOptions.length) return false; 197 198 setData(selector, selectedOptions, true); 199 return true; 200 }