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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:55:34+00:00 2026-05-24T23:55:34+00:00

I have a textfield with drop down suggestion box. I created a plugin for

  • 0

I have a textfield with drop down suggestion box. I created a plugin for the textfield to display search suggestions. But the keyup and blur events are not firing.

    (function($){
    $.fn.suggestions = function(input, suggestbox, options){
        alert("page loaded");
        alert(this.css("visibility"));
        this.keyup(function(event){
                alert(this.val());
                if(this.val() != ""){
                    $(suggestbox).css("visibility", "visible");
                    alert($(suggestbox).css("visibility"));
                    $(suggestbox).hide();
                    $(suggestbox).fadeIn("fast");
                    var query = this.val();
                    $(suggestbox).empty();
                    $(suggestbox).append("<ul>").css({
                                'list-style-type': 'none',
                                'cursor': 'pointer'
                            });
                    input(query, function(companies){
                        $.each(companies, function(index, value){
                            $(suggestbox).append("<li>" + value + "</li>").children("li").mouseover(function(event){
                                $(this).removeClass(options.mouseoutcss);
                                $(this).addClass(options.mouseincss);
                            }).mouseout(function(){
                                $(this).removeClass(options.mouseincss);
                                $(this).addClass(options.mouseoutcss);
                            }).click(function(){
                                        this.val($(this).text());
                                        $(suggestbox).hide();
                                    });
                        });
                    });
                    $(suggestbox).append("</ul>");
                }else{
                    $(suggestbox).fadeOut("fast", function(){
                        $(suggestbox).css("visibility", "hidden");
                    });
                }
            });

            this.blur(function(){
                setTimeout(function(){
                    if($(suggestbox).css("visibility") == "visible"){
                        $(suggestbox).hide();
                    }
                }, 200);
            });

    };

}) (jQuery);

I’ve also tried the following but no luck either.

        this.each(function(){
    $(this).keyup(function(event){....});
});
  • 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-24T23:55:35+00:00Added an answer on May 24, 2026 at 11:55 pm

    Cause

    this.val is not a function in your keyup handler. this would refer to the html element, not a jQuery object. Your handler is being triggered, but it is throwing an error right at the start.

    Solution

    Ensure that you are using a jQuery object where appropriate in your handlers. For example, change this.val to $(this).val. I have created a jsFiddle demonstrating some of the required fixes. It will not completely work, as the code you gave was incomplete, but it should show you some of the corrections that are required.

    Notes

    • this, in the scope of the jQuery plugin, is a jQuery object.
    • this, in the scope of an event handler, is an HTML element object.
    • To get a jQuery object for a given HTML element object, do $(myHtmlElem), where myHtmlElem is an HTML element object.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text field (flash.display.textField) for editing, but the default font does not
I have a continuous form that contains a drop down box whos control source
I have a combo box(drop down list) and a text field on the page.
I created drop down menu layouts as follows. <select name=search id=search > <option value=0>Please
I have a textfield which displays a result but I don't want it to
I have a drop-down list of colors, and when selected, i want to change
I have the items for a combo box being loaded from a store but
I have a drop down which builds a form based of the selections that
I'm trying to create a select box drop down with a twist, Basically this
I have a form for creating/editing an event. There is a Client drop down

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.