-2

So I was looking for an easy way(no use of database) to search items through a list with the help of a search bar.

I found this --- jsfiddle.net/TrRMG/90/

<input type="text" id="search">
<br>
<select id="customer" size="1">
  <option value=100>Alice</option>
  <option value=101>Bob</option>
  <option value=102>Carla</option>
  <option value=103>Dan</option>
  <option value=104>Eve</option>
</select>

Is there anyway to alter the code to make the searched items clickable?

Example:

Lets say I type in bob. Bob comes up in the second box, I click on it and it takes me to a page/website.

Is this possible? if so, how?

Jatin
  • 3,065
  • 6
  • 28
  • 42
Pbellum
  • 5
  • 1
  • 4
  • See something along these lines. It uses jQuery, but writing something like this from scratch would take a little while and probably ins't worth the effort. http://stackoverflow.com/questions/4536055/jquery-autocomplete-where-the-results-are-links – Adam Aug 13 '14 at 22:53
  • http://tablefilter.free.fr/ – racecarjonathan Aug 13 '14 at 23:04

1 Answers1

0

Something like this?

http://jsfiddle.net/TrRMG/107/

Added link="http://jsfiddle.net/TrRMG/107/" to each <option> tag and the following jQuery function

$('#customer option').click(function(){
    window.location='$(this).attr(link)'; 
});

It works kinda wonky because jsfiddle is working in iframes but implemented onto an actual page it should work just fine

Jake Ferrante
  • 28
  • 1
  • 5