")),I.css({width:J.outerWidth()}),q=j>0||i.showResultListWhenNoMatch||i.creationText,q&&H.show(),a.isFunction(i.afterResultListShow)&&i.afterResultListShow.call(this,q)},A=function(a){var b,c,d;if(H.find(":visible").length){switch(c=H.find("li"),a){case"down":d=c.eq(0);break;default:d=c.filter(":last")}if(b=H.find("li.active:first"),b.length)switch(a){case"down":d=b.next();break;default:d=b.prev()}c.removeClass("active"),d.addClass("active")}},b=function(){j&&(j.abort(),j=null)},M={clear:function(){var a;return a={id:L},c.onRemoveErrorMessage(s,a,s,i)},allValid:function(a){return a>=i.minChars&&a<=i.maxChars},renderMinChars:function(){var a;return a={id:L,errorMessage:"must be at least "+i.minChars+" characters",type:"minChars",limit:i.minChars},c.onRenderErrorMessage(s,a,s,i)},renderMaxChars:function(){var a;return a={id:L,errorMessage:"must be "+i.maxChars+" characters or fewer",type:"maxChars",limit:i.maxChars},c.onRenderErrorMessage(s,a,s,i)}},s.on({focus:function(){return m=a(this),!i.usePlaceholder&&m.val()===i.startText&&l.isEmpty()?m.val(""):u&&(J.find("li.as-selections-item").removeClass("blur"),""!==m.val()&&(I.css({width:J.outerWidth()}),M.allValid()&&H.show())),v&&clearInterval(v),v=setInterval(function(){i.showResultList&&(i.selectionLimit&&J.find("li.as-selection-item").length>=i.selectionLimit?(I.html('
'+i.limitText+"
"),M.allValid()&&H.show()):x())},i.keyDelay),u=!0,0===i.minChars&&F(m.val()),!0},blur:function(){m=a(this),!i.usePlaceholder&&""===m.val()&&l.isEmpty()&&i.minChars>0?m.val(i.startText):u&&(J.find("li.as-selection-item").addClass("blur").removeClass("selected"),H.hide()),v&&clearInterval(v),e.setPlaceholderEnabled(m,l.isEmpty())},keyup:function(){var a;return a=s.val().replace(/(,)/g,"").length,a>i.maxChars&&M.renderMaxChars(),M.allValid(a)||0===a?M.clear():void 0},keydown:function(d){var g,h,j,k,m,n;switch(y=d.keyCode,h=!1,j=s.val().replace(/(,)/g,""),d.keyCode){case 38:d.preventDefault(),A("up");break;case 40:d.preventDefault(),a(":visible",H).length>0?A("down"):(K&&clearTimeout(K),K=setTimeout(function(){x()},i.keyDelay));break;case 8:""===s.val()&&(n=l.getAll(),m=null,m=n.length?n[n.length-1]:null,J.children().not(t.prev()).removeClass("selected"),t.prev().hasClass("selected")?(l.remove(m),c.onSelectionRemove(s,t.prev(),i,null,l.getAll())):(c.onSelectionClick(s,t.prev(),i,null,l.getAll()),t.prev().addClass("selected"))),1===s.val().length&&(H.hide(),D="",b(),M.clear()),H.find(":visible").length&&(K&&clearTimeout(K),K=setTimeout(function(){x()},i.keyDelay));break;case 9:case 13:case 188:z=9===d.keyCode,g=H.find("li.active:visible:first"),13===d.keyCode&&H.find("li.active:first").length?(g.click(),H.hide(),i.neverSubmit&&d.preventDefault(),g=H.find("li.active:first")):i.canGenerateNewSelections?j.length>i.maxChars?M.renderMaxChars():0!==j.length&&j.lengthe;e++)c=d[e],b.trigger("addSelection",c)},remove:function(){var b,c,d,e,f;for(d=1<=arguments.length?i.call(arguments,0):[],b=a(this),e=0,f=d.length;f>e;e++)c=d[e],b.trigger("removeSelection",c)},defaults:function(b,c){null==c&&(c=!1),c&&(f={}),a.extend(f,b)}},a.fn.autoSuggest=function(a){return g[a]?g[a].apply(this,Array.prototype.slice.call(arguments,1)):g.init.apply(this,arguments)}}.call(this);
\ No newline at end of file
+!function(){var a,b,c,d,e,f,g,h=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},i=[].slice;a=jQuery,e=function(){function b(){}return b.prototype._=void 0,b.escapeQuotes=function(a){return a?a.replace(/"/g,'\\"'):void 0},b.escapeHtml=function(b){return a("").text(b).html()},b.setPlaceholderEnabled=function(a,b){var c,d,e;d=["placeholder","disabled-placeholder"],b?(c=d[1],e=d[0]):(c=d[0],e=d[1]),!a.attr(e)&&a.attr(c)&&(a.attr(e,function(){return a.attr(c)}),a.removeAttr(c))},b}(),b=function(){function b(){}return b.prototype._=void 0,b.getExtraParams=function(b){var c,d,e,f,g,h,i;if(f=b.extraParams,a.isFunction(f)&&(f=f(this)),"string"===a.type(f)){for(c={},i=f.split("&"),g=0,h=i.length;h>g;g++)d=i[g],""!==d&&(e=d.split("=",2),e.length&&(c[e[0]]=e[1]));f=c}return f},b}(),d=function(){function b(a,b){this.hiddenField=a,this.items=null!=b?b:[]}return b.prototype._=void 0,b.prototype.hiddenField=null,b.prototype.items=null,b.prototype.syncToHiddenField=function(){var a,b,c,d,e;if(this.hiddenField){for(b="",e=this.items,c=0,d=e.length;d>c;c++)a=e[c],b+=","+a;b&&(b+=","),this.hiddenField.val(b||",")}},b.prototype.add=function(a){this.exist(a)||this.items.push(a),this.syncToHiddenField()},b.prototype.remove=function(b){this.items=a.grep(this.items,function(a){return a!==b}),this.syncToHiddenField()},b.prototype.isEmpty=function(){return 0===this.items.length},b.prototype.exist=function(b){return-1!==a.inArray(b,this.items)},b.prototype.getAll=function(){return this.items.slice(0)},b.prototype.clear=function(){this.items=[],this.syncToHiddenField()},b}(),c=function(){function b(){}return b.onSelectionAdd=function(b,c,d,f,g,h){var i;i=f.onSelectionAdd.call(b,c,d,f),e.setPlaceholderEnabled(b,0===h.length),a.isFunction(f.afterSelectionAdd)&&f.afterSelectionAdd.call(b,i,g,h)},b.onSelectionRemove=function(b,c,d,f,g){a.isFunction(d.onSelectionRemove)&&d.onSelectionRemove.call(b,c,d),e.setPlaceholderEnabled(b,0===g.length),a.isFunction(d.afterSelectionRemove)&&d.afterSelectionRemove.call(b,c,f,g)},b.onSelectionClick=function(b,c,d,f,g){a.isFunction(d.afterSelectionClick)&&d.afterSelectionClick.call(b,c,f,g),e.setPlaceholderEnabled(b,0===g.length)},b.onAjaxRequestDone=function(b,c,d){a.isFunction(d.onAjaxRequestDone)&&c.done(d.onAjaxRequestDone)},b.onAjaxRequestFail=function(b,c,d){a.isFunction(d.onAjaxRequestFail)&&c.fail(d.onAjaxRequestFail)},b.onAjaxRequestAlways=function(b,c,d){a.isFunction(d.onAjaxRequestAlways)&&c.always(d.onAjaxRequestAlways)},b.onRenderErrorMessage=function(b,c,d,e){a.isFunction(e.onRenderErrorMessage)&&e.onRenderErrorMessage.call(b,c,d,e)},b.onRemoveErrorMessage=function(b,c,d,e){a.isFunction(e.onRenderErrorMessage)&&e.onRemoveErrorMessage.call(b,c,d,e)},b}(),f={asHtmlID:!1,useOriginalInputName:!1,usePlaceholder:!1,preFill:null,startText:"Enter Name Here",emptyText:"No Results Found",emptyTextPlaceholder:/\{\d+\}/,limitText:"No More Selections Are Allowed",selectedItemProp:"value",selectedValuesProp:"value",searchActive:!0,searchObjProps:"value",queryParam:"q",limitParam:"limit",retrieveLimit:null,extraParams:null,matchCase:!1,minChars:1,maxChars:100,keyDelay:400,resultsHighlight:!0,selectionLimit:!1,showResultList:!0,showResultListWhenNoMatch:!1,canGenerateNewSelections:!0,start:null,afterSelectionClick:null,afterSelectionAdd:null,afterSelectionRemove:null,onSelectionAdd:function(a,b){return a.before(b),a.prev()},onSelectionRemove:function(a,b){return b.fadeOut?a.fadeOut(b.fadeOut,function(){return a.remove()}):a.remove()},onRenderErrorMessage:function(b,c){var d;return d=a("#"+b.id),d.length||(c.closest("ul").after(""),d=a("#"+b.id)),d.text(b.errorMessage),setTimeout(function(){return c.focus()},10)},onRemoveErrorMessage:function(b){return a("#"+b.id).remove()},formatList:null,beforeRequest:null,afterRequest:null,onAjaxRequestDone:null,onAjaxRequestFail:null,onAjaxRequestAlways:null,onResultItemClick:null,afterResultListShow:null,neverSubmit:!1,preventPropagationOnEscape:!1,ajaxOptions:{type:"get",dataType:"json"},inputAttrs:{autocomplete:"off"},fadeOut:!1,remoteFilter:!1},g={init:function(g,i){var j,k;return i=a.extend({},f,i),j=null,"auto"===i.remoteFilter&&(i.remoteFilter="string"===a.type(g)),(k=function(){switch(a.type(g)){case"function":return g;case"string":return function(d,e){var f,h,k,l;l={},l[""+i.queryParam]=encodeURIComponent(decodeURIComponent(d)),i.retrieveLimit&&(l[i.limitParam]=encodeURIComponent(i.retrieveLimit)),h=b.getExtraParams(i),"object"===a.type(h)&&a.extend(l,h),f=a.extend({},i.ajaxOptions,{url:g,data:l}),k=function(b){return a.isFunction(i.afterRequest)&&(b=i.afterRequest.apply(this,[b])),e(b,d)},j=a.ajax(f).done(k),c.onAjaxRequestDone(this,j,i),c.onAjaxRequestFail(this,j,i),c.onAjaxRequestAlways(this,j,i)};case"array":case"object":return function(a,b){return b(g,a)}}}())?this.each(function(){var b,f,g,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T;switch(i.inputAttrs=a.extend(i.inputAttrs,{}),u=!1,s=a(this),m=null,n=null,o=null,p=null,q=null,L=null,i.asHtmlID?(m=i.asHtmlID,n=m,p="as-values-"+m,L="as-validation-error-"+m,i.useOriginalInputName?(q=s.attr("name"),s.attr({name:"old_"+s.attr("name")})):q="as_values_"+m):(m=""+(m||"")+Math.floor(100*Math.random()),n="as-input-"+m,p="as-values-"+m,L="as-validation-error-"+m,i.useOriginalInputName?(q=s.attr("name"),s.attr({name:"old_"+s.attr("name")})):q="as_values_"+m),i.inputAttrs.id=n,i.usePlaceholder||(i.inputAttrs.placeholder=i.startText),s.attr(i.inputAttrs),s.addClass("as-input"),i.usePlaceholder||s.val(i.startText),s.wrap('
")),I.css({width:J.outerWidth()}),q=j>0||i.showResultListWhenNoMatch||i.creationText,q&&H.show(),a.isFunction(i.afterResultListShow)&&i.afterResultListShow.call(this,q)},A=function(a){var b,c,d;if(H.find(":visible").length){switch(c=H.find("li"),a){case"down":d=c.eq(0);break;default:d=c.filter(":last")}if(b=H.find("li.active:first"),b.length)switch(a){case"down":d=b.next();break;default:d=b.prev()}c.removeClass("active"),d.addClass("active")}},b=function(){j&&(j.abort(),j=null)},M={clear:function(){var a;return a={id:L},c.onRemoveErrorMessage(s,a,s,i)},allValid:function(a){return a>=i.minChars&&a<=i.maxChars},renderMinChars:function(){var a;return a={id:L,errorMessage:"must be at least "+i.minChars+" characters",type:"minChars",limit:i.minChars},c.onRenderErrorMessage(s,a,s,i)},renderMaxChars:function(){var a;return a={id:L,errorMessage:"must be "+i.maxChars+" characters or fewer",type:"maxChars",limit:i.maxChars},c.onRenderErrorMessage(s,a,s,i)}},s.on({focus:function(){return m=a(this),!i.usePlaceholder&&m.val()===i.startText&&l.isEmpty()?m.val(""):u&&(J.find("li.as-selections-item").removeClass("blur"),""!==m.val()&&(I.css({width:J.outerWidth()}),M.allValid()&&H.show())),v&&clearInterval(v),v=setInterval(function(){i.showResultList&&(i.selectionLimit&&J.find("li.as-selection-item").length>=i.selectionLimit?(I.html('
'+i.limitText+"
"),M.allValid()&&H.show()):x())},i.keyDelay),u=!0,0===i.minChars&&F(m.val()),!0},blur:function(){m=a(this),!i.usePlaceholder&&""===m.val()&&l.isEmpty()&&i.minChars>0?m.val(i.startText):u&&(J.find("li.as-selection-item").addClass("blur").removeClass("selected"),H.hide()),v&&clearInterval(v),e.setPlaceholderEnabled(m,l.isEmpty())},keyup:function(){var a;return a=s.val().replace(/(,)/g,"").length,a>i.maxChars&&M.renderMaxChars(),M.allValid(a)||0===a?M.clear():void 0},keydown:function(d){var g,h,j,k,m,n;switch(y=d.keyCode,h=!1,j=s.val().replace(/(,)/g,""),d.keyCode){case 38:d.preventDefault(),A("up");break;case 40:d.preventDefault(),a(":visible",H).length>0?A("down"):(K&&clearTimeout(K),K=setTimeout(function(){x()},i.keyDelay));break;case 8:""===s.val()&&(n=l.getAll(),m=null,m=n.length?n[n.length-1]:null,J.children().not(t.prev()).removeClass("selected"),t.prev().hasClass("selected")?(l.remove(m),c.onSelectionRemove(s,t.prev(),i,null,l.getAll())):(c.onSelectionClick(s,t.prev(),i,null,l.getAll()),t.prev().addClass("selected"))),1===s.val().length&&(H.hide(),D="",b(),M.clear()),H.find(":visible").length&&(K&&clearTimeout(K),K=setTimeout(function(){x()},i.keyDelay));break;case 9:case 13:case 188:z=9===d.keyCode,g=H.find("li.active:visible:first"),13===d.keyCode&&H.find("li.active:first").length?(g.click(),H.hide(),i.neverSubmit&&d.preventDefault(),g=H.find("li.active:first")):i.canGenerateNewSelections?j.length>i.maxChars?M.renderMaxChars():0!==j.length&&j.lengthe;e++)c=d[e],b.trigger("addSelection",c)},remove:function(){var b,c,d,e,f;for(d=1<=arguments.length?i.call(arguments,0):[],b=a(this),e=0,f=d.length;f>e;e++)c=d[e],b.trigger("removeSelection",c)},defaults:function(b,c){null==c&&(c=!1),c&&(f={}),a.extend(f,b)}},a.fn.autoSuggest=function(a){return g[a]?g[a].apply(this,Array.prototype.slice.call(arguments,1)):g.init.apply(this,arguments)}}.call(this);
\ No newline at end of file
diff --git a/scss/jquery.autoSuggest.scss b/scss/jquery.autoSuggest.scss
index a0d491b..50a1698 100644
--- a/scss/jquery.autoSuggest.scss
+++ b/scss/jquery.autoSuggest.scss
@@ -147,7 +147,7 @@ ul {
}
}
}
- + .error {
+ + .as-error {
color: red;
}
}
diff --git a/src/jquery.autoSuggest.coffee b/src/jquery.autoSuggest.coffee
index 5b85b64..afa51a2 100644
--- a/src/jquery.autoSuggest.coffee
+++ b/src/jquery.autoSuggest.coffee
@@ -364,7 +364,7 @@ defaults =
onRenderErrorMessage : (validationData, element, options) ->
error = $("##{validationData.id}")
unless error.length
- element.closest('ul').after ""
+ element.closest('ul').after ""
error = $("##{validationData.id}")
error.text validationData.errorMessage
# Brief timeout to ensure focus even when user presses tab.