Basically what I\'m looking for is the ability to hide options from the dropdown of select items. So, technically they would still be options, but you just wouldn\'t be able
If you want to achieve it , maybe you can modify the select2.js code,
First i hidden the second option , originally it will not work when you use
select2 plugin ,
Second i will modify the select2.js code: line 926
i add extra condition statement && element.css('display') != 'none' here
process = function (element, collection) {
var group;
if (element.is("option") && element.css('display') != 'none') {
if (query.matcher(term, element.text(), element)) {
collection.push(self.optionToData(element));
}
} else if (element.is("optgroup")) {
group = self.optionToData(element);
element.children().each(function (i, elm) {
process(elm, group.children);
});
if (group.children.length > 0) {
collection.push(group);
}
}
};
JSBIN http://jsbin.com/qusimi/1/edit