From c081d0f00c29563f46d96cd5284f647f92923097 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 13 Feb 2013 01:15:05 -0800 Subject: [PATCH] fix placeholder problem. fixes #853 --- select2.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/select2.js b/select2.js index 4dd6d6c0..2f18fd05 100644 --- a/select2.js +++ b/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();