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

  • Home
  • SEARCH
  • 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 6773669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:41:43+00:00 2026-05-26T15:41:43+00:00

I have a form with many inputs, all of them with the class field.

  • 0

I have a form with many inputs, all of them with the class “field”. On my JavaScript file, I have something like this:

$(".field").autocomplete({
    source:"search.php",
    select:function(event,ui){$(???).doStuff();}
    });

What I need is some way to refer to the input field where the user is writing (that is, some selector in place of the “???”), so that I can do some stuff with the surrounding elements. I am guessing that the answer is something like “ui.field”, “ui.input” or “ui.element”, but I tried those and others with no luck, and I couldn’t find the answer in the documentation nor here, so I turn to you. Thanks!

  • 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-26T15:41:44+00:00Added an answer on May 26, 2026 at 3:41 pm

    It’s this (that’s the raw element, not wrapped), as with most jQuery events. This could be documented better. 🙂 So in your case:

    $(".field").autocomplete({
        source:"search.php",
        select:function(event,ui){
            // Here, `this` is the raw DOM element of the field
            $(this).doStuff();
        }
    });
    

    Example (live copy):

    HTML:

    <p>Type a <kbd>t</kbd> then pick a choice. The field will turn green briefly.</p>
    <input class="ac" type="text">
    <input class="ac" type="text">
    <input class="ac" type="text">
    

    JavaScript:

    jQuery(function($) {
      $(".ac").autocomplete({
        source: ["two", "three", "thirty"],
        select: function(event, ui) {
          var $this = $(this);
          $this.css("color", "green");
          setTimeout(function() {
            $this.css("color", "");
          }, 500);
        }
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of input forms, all of them take a different form
i have a form that has many input fields. some fields of them are
I have a form in contact.php with a considerable amount of inputs. this form
I have dynamic form like: <form id=formaa> <div class=row> <input type=text name=item class=item></input> <input
I have many different forms in my app, all of them are using remote:
I'm need to simulate a web form's ability to include as many File inputs
I currently have an ASP.Net Web Form that looks like this: Each section of
Lets say I have something like this: http://gyazo.com/642987562175afc6d11a962762327744.png?1329570534 Basically, the user fills out this
I have a form that I'm submitting through AJAX. The form includes many fields,
I am using asp.net/C# ,, i have a form with many fields ,,, it

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.