Lines Matching refs:val

173         var val, i, l;
175 val = string.split(separator);
176 for (i = 0, l = val.length; i < l; i = i + 1) val[i] = $.trim(val[i]);
177 return val;
188 $.data(element, key, element.val());
192 var val= $.data(element, key);
193 if (val !== undefined && element.val() !== val) {
269 var el=$el[0], pos=$el.val().length, range;
278 /* after the focus is set move the caret to the end, necessary when we val()
338 sizer.text(e.val());
571 function evaluate(val) {
572 if ($.isFunction(val)) {
574 return val.apply(null, args);
576 return val;
987 // this is needed because inside val() we construct choices from options and there id is hardcoded
1008 $(splitVal(element.val(), opts.separator)).each(function () {
1092 var evt = $.Event("select2-selecting", { val: this.id(data), object: data });
1104 details= $.extend({}, details, { type: "change", val: this.val() });
1416 this.search.val(term);
1521 this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
1561 term=this.search.val(),
1616 term = search.val(),
1658 if (search.val().length < opts.minimumInputLength) {
1660 render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, search.val(), opts.minimumInputLength) + "</li>");
1668 if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
1670 render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, search.val(), opts.maximumInputLength) + "</li>");
1688 search.val(input);
1695 term: search.val(),
1716 if (this.opts.createSearchChoice && search.val() !== "") {
1717 def = this.opts.createSearchChoice.call(self, search.val(), data.results);
1729 render("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, search.val()) + "</li>");
1734 self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
1809 } else if (firstOption.text() === "" && firstOption.val() === "") {
1913 // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
1916 this.search.val(this.focusser.val());
1920 // new text will appear *before* focusser.val()
1927 len = this.search.val().length;
1933 if(this.search.val() === "") {
1935 this.search.val(this.nextSearchTerm);
1940 this.focusser.prop("disabled", true).val("");
2185 this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
2191 this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
2214 self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
2224 || (this.opts.element.val() === "")
2225 || (this.opts.element.val() === undefined)
2226 || (this.opts.element.val() === null);
2244 var id = element.val();
2301 if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
2343 var old = this.opts.element.val(),
2346 this.opts.element.val(this.id(data));
2349 this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
2351 this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
2390 val: function () {
2391 var val,
2398 return this.opts.element.val();
2401 val = arguments[0];
2409 .val(val)
2420 // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
2421 if (!val && val !== 0) {
2426 throw new Error("cannot call val() if initSelection() is not defined");
2428 this.opts.element.val(val);
2430 self.opts.element.val(!data ? "" : self.id(data));
2442 this.search.val("");
2443 this.focusser.val("");
2463 this.opts.element.val(!value ? "" : this.id(value));
2514 var ids = splitVal(element.val(), opts.separator);
2764 if (this.opts.element.val() === "" && this.opts.element.text() === "") {
2770 if (this.select || this.opts.element.val() !== "") {
2789 this.search.val(placeholder).addClass("select2-default");
2794 this.search.val("").width(10);
2801 this.search.val("").removeClass("select2-default");
2816 if(this.search.val() === "") {
2818 this.search.val(this.nextSearchTerm);
2867 var input = this.search.val();
2870 this.search.val(input);
2885 this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
2888 this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
2902 if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
2909 this.search.val(this.nextSearchTerm);
2949 val = this.getVal(),
2983 val.push(id);
2984 this.setVal(val);
2989 var val = this.getVal(),
3007 evt.val = this.id(data);
3015 while((index = indexOf(this.id(data), val)) >= 0) {
3016 val.splice(index, 1);
3017 this.setVal(val);
3023 this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
3031 var val = this.getVal(),
3038 if (indexOf(id, val) >= 0) {
3061 this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.search.val()) + "</li>");
3104 var val;
3106 val = this.select.val();
3107 return val === null ? [] : val;
3109 val = this.opts.element.val();
3110 return splitVal(val, this.opts.separator);
3115 setVal: function (val) {
3118 this.select.val(val);
3122 $(val).each(function () {
3125 this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
3153 val: function (val, triggerChange) {
3163 // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
3164 if (!val && val !== 0) {
3165 this.opts.element.val("");
3174 // val is a list of ids
3175 this.setVal(val);
3184 throw new Error("val() cannot be called if initSelection() is not defined");
3215 var val=[], self=this;
3226 val.push(self.opts.id($(this).data("select2-data")));
3228 this.setVal(val);
3260 allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
3262 propertyMethods = ["val", "data"],