fix placeholder problem. fixes #853
This commit is contained in:
parent
244ba1bb43
commit
c081d0f00c
20
select2.js
20
select2.js
@ -1473,14 +1473,6 @@ the specific language governing permissions and limitations under the Apache Lic
|
||||
|
||||
// abstract
|
||||
getPlaceholder: function () {
|
||||
|
||||
// if a placeholder is specified on a select without the first empty option ignore it
|
||||
if (this.select) {
|
||||
if (this.select.find("option").first().text() !== "") {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return this.opts.element.attr("placeholder") ||
|
||||
this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
|
||||
this.opts.element.data("placeholder") ||
|
||||
@ -1807,6 +1799,18 @@ the specific language governing permissions and limitations under the Apache Lic
|
||||
return opts;
|
||||
},
|
||||
|
||||
// single
|
||||
getPlaceholder: function() {
|
||||
// if a placeholder is specified on a single select without the first empty option ignore it
|
||||
if (this.select) {
|
||||
if (this.select.find("option").first().text() !== "") {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return this.parent.getPlaceholder.apply(this, arguments);
|
||||
},
|
||||
|
||||
// single
|
||||
setPlaceholder: function () {
|
||||
var placeholder = this.getPlaceholder();
|
||||
|
Loading…
x
Reference in New Issue
Block a user