app/assets/javascripts/scoped_search.js in scoped_search-4.1.3 vs app/assets/javascripts/scoped_search.js in scoped_search-4.1.4
- old
+ new
@@ -23,10 +23,11 @@
$.fn.scopedSearch = function(){
var options = arguments[0] || {};
$(this).each(function(i,el){
var target = $(el);
+ var clearFn = options.onClear || function(){ target.val(''); };
target.catcomplete({
source: options.source || function( request, response ) {
$.getJSON( target.data("url"), { search: request.term }, response );
},
@@ -48,8 +49,8 @@
target.bind("focus", function( event ){
$(this).catcomplete( target.attr('id'));
});
target.after('<a class="autocomplete-clear" tabindex="-1" title="Clear">×</a>')
- target.next().on("click",function(){ target.val(''); })
+ target.next().on("click", clearFn)
})
- };
\ No newline at end of file
+ };