text: $.fn.selectctr=function(t){var a=$.extend({arrow:'<span class="input-group-addon" data-toggle="dropdown"><i class="fa fa-angle-down" aria-hidden="true"></i></span>',css:null},t);return this.each(function(){var t=this;$(this).hide();var e=$(this).val(),s=$(this).css("width"),i=document.createElement("div");$(i).addClass("input-group select-control").css("width",s),a.css&&$(i).css(a.css),i.innerHTML='<span data-toggle="dropdown" class="input-group-addon select-val"></span>';var n=i.firstChild,r=document.createElement("ul");$(r).addClass("dropdown-menu");var d=[];$(this).find("option").each(function(){if("undefined"!=typeof $(this).closest("optgroup").attr("label")&&-1==$.inArray($(this).closest("optgroup").attr("label"),d)){d.push($(this).closest("optgroup").attr("label"));var a=document.createElement("li");a.innerHTML='<a href="javascript:void(0)"><b>'+$(this).closest("optgroup").attr("label")+"</b></a>",$(a).addClass("opt-group"),r.append(a)}var s=document.createElement("li");s.innerHTML='<a href="javascript:void(0)">'+$(this).text()+"</a>",$(s).attr("id",$(this).val()).addClass("select-sort-item"),e===$(this).val()&&($(s).addClass("active"),$(n).html($(this).text())),$(s).bind("click",function(a){var e=$(this).attr("id");$(n).html($(this).text()),$(t).val(e).trigger("change"),$(r).children("li").each(function(){$(this).removeClass("active"),$(this).attr("id")===e&&$(this).addClass("active")})}),r.append(s)}),i.appendChild(r);var l=document.createElement("template");l.innerHTML=a.arrow,i.appendChild(l.content.firstChild),$(this).after(i)})};