Enabling jQuery Autocomplete on dynamically created input fields

前端 未结 5 1024
鱼传尺愫
鱼传尺愫 2021-01-05 15:23

I\'ve read almost every article i could find on how to accomplish this, but i\'m still failing miserably. mostly because i\'m an amateur at jQuery/Javascript.

I have

5条回答
  •  孤街浪徒
    2021-01-05 15:55

    See http://jsfiddle.net/r08m8vvy/2/

    Give the new input an ID and call autocomplete on it. The initial autocompate call you make won't include the dynamically added inputs.

     $(wrapper).append(''); //add input box
    
     $( "input[id="+ x +"]" ).autocomplete({
         source: availableAttributes
     });    
    

提交回复
热议问题