Every line of 'javascript add options to select dynamically' 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.
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 }
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 }
1 function add_options_to_select($select, opt_list, selected_val) { 2 for (var i = 0; i < opt_list.length; i++) { 3 var $opt = $('
81 function selectCallback(value, index) { 82 $(".demo .callback_output").prepend("<p>VALUE: " + value + ", INDEX: " + index + "</p>"); 83 }
3 function appendOption ($select, option) { 4 $select.append($('') 5 .attr('value', option.id).text(option.text)); 6 }
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($('
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 }
55 addOption(select: HTMLSelectElement, optionText: string) { 56 var option = document.createElement('option'); 57 option.text = optionText; 58 select.options.add(option); 59 }
37 generateSelectOptions() { 38 let result = []; 39 let options = [ 40 { 41 value: 'none', 42 label: 'None' 43 }, 44 { 45 value: 'good', 46 label: 'Good' 47 }, 48 { 49 value: 'info', 50 label: 'Info' 51 }, 52 { 53 value: 'warn', 54 label: 'Warn' 55 }, 56 { 57 value: 'danger', 58 label: 'Danger' 59 } 60 ]; 61 options.forEach(opt => { 62 result.push( 63 64 ); 65 }); 66 return result; 67 }
227 function generateMultivalueSelectScript(el) { 228 return appendScript(el, multivalueselectTemplate(), generatedNonExecuteScriptClass, multiValueSelectScriptType); 229 }