Customize jQuery.aptags plugin - mouseclick submit from dropdown list
Posted
by atmorell
on Stack Overflow
See other posts from Stack Overflow
or by atmorell
Published on 2010-04-18T13:48:30Z
Indexed on
2010/04/18
13:53 UTC
Read the original article
Hit count: 367
jQuery
|autocomplete
Hello,
I am using jquery.autocomplete.js and jquery.apitags to select a few elements from a dropdown list. This works great, and I can select multiple elements etc. However the jquery-aptags plugin does only fire when enter is pressed. This might confuse some users if they use the mouse to click instead of the arrows/enter on the keyboard.
I think this is the code inside jquery.aptags that submits the tag.
//
// Hook to the keypress event.
//
$(this).bind('keypress', {
__c: __c
}, function (e) {
var c = '';
var i = 0;
var v = $(this).val();
if (e.keyCode == 13) {
e.stopPropagation();
e.preventDefault();
__createSpans(this, v, e.data.__c, true);
}
});
I am wondering if it is possible to call the method directly from a new event.
$('.ac_results > ul > li').livequery(function() {
$(this).bind('click', function() {
$('#address_city').aptags({__createSpans});
});
});
Any thoughts?
© Stack Overflow or respective owner