我正在使用select2插件,但是我迷失了--它做的是选择值的select2,而是显示了"undefined"以前我使用的是一个隐藏字段,除了显示"undefined to selected value"之外,所有这些都在工作,当我将它更改为select时,它就坏了。name="cities" id="cities" data-rel=&quo 浏览7提问于2014-10-11得票数 3 2回答 为什么在...
假设您有<option>已经有value的initial_creditor_id。如果不选择 Select2,浏览器实际上将无法更改该值,因为没有选项可以切换到,并且 Select2 将不会检测到新值。我注意到你的<select>仅包含一个选项,即占位符选项,这意味着您需要创建新的<option>手动。 var $option = $("<option selected></option>").val(...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Select2 Multi-select Example</title> <!-- 引入jQuery --> <script src="https...
value Select2Value initial value minCharForSearch number 0 start the search when the number of characters is reached (0 = unlimited) minCountForSearch number 6 hide search box if options.length < minCountForSearch displaySearchStatus 'default''hidden''always' 'default' display the search bo...
// selected tags on initialization when the (maintain the order of selection) echo '<label class="control-label">Tag Multiple</label>'; echo Select2::widget([ 'name' => 'color_2a', 'value' => ['teal', 'green', 'red'], // initial value (will be ordered accordingly and pushed ...
Select2 provides a way to load the data from a local array. You can provide initial selections with array data by providing the option tag for the selected values, similar to how it would be done for a standard select. enhancement
你必须在其它地方能获取到这个select标签,所以要为其设置id、class或者是name以便能得到这个标签。multiple...
<select2[data]="data"[value]="value"(update)="update($event)"></select2> properties and events of the component nametypestatusdefaultdescriptionrequired dataSelect2Datarequiredthe data of the select2 valueSelect2Valueinitial value minCharForSearchnumber0start the search when the number of character...
// init selected from elements value initSelection: function (element, callback) { var initialData = []; $(element.val().split(",")).each(function () { initialData.push({ id: this, text: this }); }); callback(initialData); ...
data: initialData }); }); // Hide the original select $element.addClass('select2-hidden-accessible'); $element.attr('aria-hidden', 'true'); // Synchronize any monitored attributes this._syncAttributes(); Utils.StoreData($element[0], 'select2', this); ...