Single jQuery autocomplete for multiple textboxes with different parameters -


is there way can use autocomplete multiple textbox elements. struggle facing want dynamically change element binding , source based on textbox calling function.

$("#element").autocomplete({     source: "../ajax/autocompletes/trucks.php",     minlength: 0,     select: function (event, ui) {         $("#element_id").val(ui.item.id);     },     change: function (event, ui) {         if (!ui.item) {             this.value = "";             alert('please select item dropdown!');         }     } }).dblclick(function () {     $(this).autocomplete("search"); }); 

i have searched google haven't found much.

try , let me know , if need further assitance

function multiautocomplete(element,sourceurl){         $(element).autocomplete({         source: sourceurl,         minlength: 0,         select: function (event, ui) {             $("#element_id").val(ui.item.id);         },         change: function (event, ui) {                     if (!ui.item) {                         this.value = "";                         alert('please select item dropdown!');                     }                 }             }).dblclick(function () {                 $(this).autocomplete("search");             });      } 

call this:

    multiautocomplete('#element','../ajax/autocompletes/trucks.php');     multiautocomplete('#element2','../ajax/autocompletes/trucks2.php');     multiautocomplete('#element3','../ajax/autocompletes/trucks3.php'); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -