Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:15:38+00:00 2026-05-26T04:15:38+00:00

I am using this autocomplete Plugin working with Jquery: jQuery Autocomplete Mod You use

  • 0

I am using this autocomplete Plugin working with Jquery: jQuery Autocomplete Mod

You use it by simple adding $(“selector”).autocomplete(url [, options]);

There are 5 Input elements (id = channel followed by a number) when the page load that’s why I use this code to init the autocomplete plugin on each input:

$(document).ready(function() {
      $('input[id^="channel"]').each(function(){       
        $(this).autocomplete(
          "autocomplete/autocomplete.php",
          {
                some options that don't matter now I guess
          }
        );        
  });
});

But now I also want the autocomplete plugin to work on Input elements (same id syntax) that are added by calling a javascript function (by clicking on a link) after the page is loaded.

I now there is the live() function of Jquery but I just don’t know how I should use it here.

I am sure there is a nice and easy way to do it but I just can#t think of the right way at the moment.

Thanks in advance!

Phil

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:15:39+00:00Added an answer on May 26, 2026 at 4:15 am

    Because autocomplete adds the events handlers, there isn’t really any good way to get it to work with dynamically added elements. You’d have to modify the plugin so that it would know, perhaps optionally, to apply the handlers dynamically. That’s a fair amount of work. An easier way is to abstract the handler into a function, then apply it to the original elements and each new element after it is added, perhaps in a callback.

    $(document).ready(function() {
        var nextChannel = $('input[id^="channel"]').length + 1;
        function addAutocomplete( selector) {
            $(selector).each(function(){       
               $(this).autocomplete(
                  "autocomplete/autocomplete.php",
                  {
                        some options that do not matter now I guess
               });        
            });
        });
        addAutocomplete('input[id^="channel"]');
    
        $('.addSearch').click( function() {
             var input = $('<input id="channel' + nextChannel + '" type="text" />')
                            .appendTo('form');
             addAutocomplete( input );
             ++nextChannel;
             return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this JQuery autocomplete plugin . It works, and it's simple. But
i have an input using the jquery autocomplete plugin. with this i want to
I am using the jQuery autocomplete plugin and have wired up an input field
I am using this plugin: http://jquery.bassistance.de/autocomplete/demo/ I have an autocomplete textarea where the values
I'm using this plugin: http://jqueryui.com/demos/autocomplete/#remote Works great but I would like to use the
I'm trying to build an autocomplete using jQuery plugin autocomplete from this site .
I'm using CodeNothing's jQuery Autocomplete plugin to enable autocomplete on a text input. The
hi i am using ajax autocomplete for jquery plugin http://www.devbridge.com/projects/autocomplete/jquery/ there is a code
I followed the directions in this post: how can we integrate jquery autocomplete using
Using this: Can I use Facebook's fb:friend-selector in an iframe? I created a multi-friend

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.