From 6b736669d28bef28040e0424811e1f556206e5cc Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Thu, 28 Jun 2012 23:50:36 -0700 Subject: [PATCH] add reference to original option element in the data when attached to select. fixes #171 --- select2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 0819103b..d0db4610 100755 --- a/select2.js +++ b/select2.js @@ -626,10 +626,10 @@ var group; if (element.is("option")) { if (query.matcher(term, element.text())) { - collection.push({id:element.attr("value"), text:element.text()}); + collection.push({id:element.attr("value"), text:element.text(), element: element.get()}); } } else if (element.is("optgroup")) { - group={text:element.attr("label"), children:[]}; + group={text:element.attr("label"), children:[], element: element.get()}; element.children().each2(function(i, elm) { process(elm, group.children); }); if (group.children.length>0) { collection.push(group);