Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-04-2011, 12:36 AM   PM User | #1
opsoyo
New to the CF scene

 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
opsoyo is an unknown quantity at this point
Autocomplete with links

I found this code:

Code:
  $(document).ready(function() {
   
    $("input#autocomplete").autocomplete({
    source: [ { id : "", value : "Adil Abounadi" },
              { id : "2", value : "Jennifer Bruning" },
              { id : "3", value : "David Huhn" },
              { id : "4", value : "Michael Jennings" },
              { id : "5", value : "Sarah Dutcher" },
              { id : "6", value : "Greg Craven" },
              { id : "7", value : "Paul Wendring" },
			  { id : "8", value : "Curt Ralston" },
			  { id : "9", value : "Jeff Witt" },
			  { id : "10", value : "Edwin Propst" },
			  { id : "11", value : "Lori Houser" },
			  { id : "12", value : "Roseanne Larson" },
			  { id : "13", value : "Terri Chappell" },
			  { id : "14", value : "Wendy Kirsch" },
			  { id : "15", value : "Ben Gorman" },
			  { id : "16", value : "Kris Jordan" },
			  { id : "17", value : "Tim Nordtvedt" },
			  { id : "18", value : "Van Holstad" },
			  { id : "19", value : "Prindi Flug" },
			  { id : "20", value : "Michael Thissell" },
			  { id : "21", value : "Amanda Laister" },
			  { id : "21", value : "Mabeck McDonough" },
			  { id : "21", value : "Sensei" },
			  { id : "21", value : "Jake Herbert" },
			  { id : "21", value : "Teri Crevar" },
			  { id : "21", value : "Eli Cirino" },
			  { id : "21", value : "Keith Omlid" },
			  { id : "21", value : "Shane Hedrick" },
			  { id : "21", value : "Bill Gsell" },
			  { id : "21", value : "Kurt Neville" },
			  { id : "21", value : "Mary Heuther" },
			  { id : "21", value : "Patti Youngren" },
			  { id : "21", value : "Laurie Fish" },
			  { id : "21", value : "John Bain" },
			  { id : "21", value : "Carol Adamus" },
			  { id : "21", value : "Ms. Nosack" },
			  { id : "21", value : "Mandie Allen" },
			  { id : "21", value : "Rachel Duncan" },
			  { id : "21", value : "Bob McBeth" },
			  { id : "21", value : "Niki Paul" }
            ],
    open: function(event, ui) {
		  $("ul.ui-autocomplete").unbind("click");
		 
		  var data = $(this).data("autocomplete");
		  console.log(data);
		   
		  for(var i=0; i<=data.options.source.length-1;i++)
		  {
			var s = data.options.source[i];
			$("li.ui-menu-item a:contains(" + s.value + ")").attr("href", s.id);
		  }
		   
		}
 
    });
  });
on another site hoping it would help me figure out how to use the jQuery Autocomplete with links. It has helped me in my understanding of the links, but it only allows you to access the links when you click with the mouse on the suggestion and I would like to know:

1) How would I implement onKeyDown in the code I have?
2) Is there a better way to be doing this? Example?

Thanks in advance..
opsoyo is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:00 PM.


Advertisement
Log in to turn off these ads.