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 8004273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:52:12+00:00 2026-06-04T16:52:12+00:00

Andrew’s answer to my comment has sparked this question. According to his awesome answer

  • 0

Andrew’s answer to my comment has sparked this question.

According to his awesome answer in the link above, the code at the bottom of the question will only work for ONE widget. But it’s killer nice code and makes sense… I guess I want the best of both worlds. Nice JS, (if that is possible) and to have the zero results show() just the element that we’re using at the time.

This code snippet is the main crux of my problem, as I see it:

        source: function (request, response) {
        jQuery.ajax({
            url: "/autocomplete.json",
            data: {
            term: request.term
            },
            success: function (data) {
            if (data.length == 0) {
        jQuery('span.guest_investor_email').show();
                jQuery('span.investor_field_delete_button').show();
            }
            response(data);
            }
        });

Currently:

I have a button on my page that says “Add more Information” and each time you click it, a new instance of the autocomplete text field appears, complete with some hidden fields and a display:none; on guest_investor_email.
If I use the autocomplete text field, say 3 times, and i have 3 autocomplete instances on the page and the third one finds 0 results: The code will show() all 3 instances of the guest_investor_email text field, instead of just this one that is blank.

QUESTION:

How do i get something like
jQuery(this).siblings(('span.guest_investor_email').show(); to work?

this is an Object and not an array of elements to select. If it isn’t with this I don’t mind, as long as I know how to get at it. Thanks.


Full Code:

     jQuery(".auto_search_complete").live("click", function() {
     jQuery(this).autocomplete({
        minLength: 3,

        source: function (request, response) {
        jQuery.ajax({
            url: "/autocomplete.json",
            data: {
            term: request.term
            },
            success: function (data) {
            if (data.length == 0) {
        jQuery('span.guest_investor_email').show();
                jQuery('span.investor_field_delete_button').show();
            }
            response(data);
            }
        });
        },

        focus: function(event, ui) {
        jQuery(this).val(ui.item.user ? ui.item.user.name : ui.item.pitch.name);
        return false;
        },
        select: function(event, ui) {
        jQuery(this).val(ui.item.user ? ui.item.user.name : ui.item.pitch.name);
        jQuery(this).siblings('div.hidden_fields').children('.poly_id').val(ui.item.user ? ui.item.user.id : ui.item.pitch.id);
        jQuery(this).siblings('div.hidden_fields').children('.poly_type').val(ui.item.user ? "User" : "Pitch");
        jQuery(this).siblings('span.guest_investor_email').hide();
                jQuery(this).siblings('span.investor_field_delete_button').show();
                jQuery(this).attr('readonly','readonly');
                jQuery(this).attr('id', "investor-selected");

        return false;
        }
    }).each(function() {
        jQuery(this).data( "autocomplete" )._renderItem = function( ul, item ) {
        return jQuery( "
  • " ) .data( "item.autocomplete", item ) .append("

    " + (item.user ? item.user.name : item.pitch.name) + "
    " + (item.user ? item.user.investor_type : item.pitch.investor_type) + " - " + (item.user ? item.user.city : item.pitch.city) + "

    " ) .appendTo( ul ); }; }); });
    • 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-06-04T16:52:14+00:00Added an answer on June 4, 2026 at 4:52 pm

      I didn’t fully understand what you want to achieve but I think you want to get the element you bind the .live event right?

      jQuery(".auto_search_complete").live("click", function() {
          var $this = $(this);
          jQuery(this).autocomplete({
              minLength: 3,
              ...
              success: function (data) {
              if (data.length == 0) {
          jQuery('span.guest_investor_email').show();
                  $this.siblings('span.investor_field_delete_button').show();
              }
          ...
      
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    Quoting the answer of Andrew Hare on the This Question . Object data sources
    In the recent question How to organize MATLAB code? Andrew Janke mentioned in his
    Updated question given Andrew Hare's correct answer: Given the following C# classes: public class
    As Andrew Hare suggested in his answer : Create a field to store all
    Edit: As Andrew Moore pointed out this question is a duplicate of Two separate
    Despite the content of the comment of @stealthcopter (check answer made by @Andrew) in
    In my previous question , Andrew Jaffe writes : In addition to all of
    I want to thank Andrew Thompson for helping me get this far in the
    Andrew Troelsen in his book Pro C# 2008 and the .NET 3.5 Platform, Fourth
    I am making use of Andrew Valums awesome AJAX file uploader. I am having

    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.