From 1633d71b4a53ff40ed2bfba4c3ffbcdb023f08ec Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Mon, 28 May 2012 23:15:41 -0700 Subject: [PATCH] add container() method that retrieves the main container --- select2.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 87fe693d..9f4cf380 100755 --- a/select2.js +++ b/select2.js @@ -1424,7 +1424,7 @@ var args = Array.prototype.slice.call(arguments, 0), opts, select2, - value, multiple, allowedMethods = ["val", "destroy", "open", "close", "focus", "isFocused"]; + value, multiple, allowedMethods = ["val", "destroy", "open", "close", "focus", "isFocused", "container"]; this.each(function () { if (args.length === 0 || typeof(args[0]) === "object") { @@ -1449,7 +1449,11 @@ value = undefined; select2 = $(this).data("select2"); if (select2 === undefined) return; - value = select2[args[0]].apply(select2, args.slice(1)); + if (args[0] === "container") { + value=select2.container; + } else { + value = select2[args[0]].apply(select2, args.slice(1)); + } if (value !== undefined) {return false;} } else { throw "Invalid arguments to select2 plugin: " + args;