Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variable instead of input ID to autocomplete

Status
Not open for further replies.

staggan

Technical User
Nov 29, 2011
1
GB
Hello

I have a working autocomplete function which populates a list from a remote database, which works nicely. However, I need to be able to pass my function a variable instead of the input id of my text input field....

Here is my code...

Code:
 $(function() {
 
      $("#input").autocomplete({
          source: "search.php?field=field1"
      });
  });
 
 
<p><b>input:</b><input type="text"  input id = "input" name="field1" size="60" ><br>
 
[/code}
 

Instead of my function using "#input" I want it to get the input id of the calling input so that I can have multiple input fields using the same autocomplete function.....
 
Any help would be appreciated
 
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top