SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    742
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question jQuery textbox change event

    Hi

    I have been struggling with this since morning today. So I hope someone can help me with my problem.

    I am using jQuery autocomplete plugin for one of my site.

    What exactly I am looking for is either of the following:

    1) When someone selects one of the data from the auto-complete list, (either by selecting it with their mouse or by pressing the enter key), the plugin should fire a callback event with the value of the text entered.

    OR

    2) By using the change event of jquery to monitor whenever a data has been selected from the list. I am trying to achieve this by using the following code:

    Code:
    	$('#search').change(function() {
    		
    		console.log('Hello World');
    	
    	});
    But apparently the above code is only triggering the event whenever the user presses any key and NOT when a data from the list is selected.

    I am attaching the relevant code. So if you could please help me with this.


    Many Thanks in advance.
    Attached Files Attached Files

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    That plugin is deprecated. It is now part of jQuery UI. You can use the jQuery UI version of autocomplete, it should be quite easy to move over.

    It has some events bound, for example "open" for when the suggestion menu is opened and "select" for when an item is selected from the menu.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •