Thursday 22 December 2016

Javascript/Jquery to go to URL from and

My problem:
I am looking to make an input box that autocompletes suggestions as I type them in. Upon typing them taking the first selection (this is already figured out in the plug-in) by either clicking or pressing enter, I'd like to submit that selection which is tied to a URL to redirect to that new URL.


This here is directly from the developer's website and an example of what is used.
















What I would use it for is to navigate a list of U.S. states. The idea here would be to redirect a new (or current window) to the URL associated with the state. Alabama going to http://www.alabama.gov, and so on.
















I stuck here:

After going through many searches and seeing that Jquery or Javascript is required for this, I've tried to go through some solutions, but cannot quite seem to make it work. It might not even be possible. I didn't want to throw in too many examples of what I tried and clutter the post up, so I tried to leave it in its most basic form with the idea in mind.


As far as I know, I'd need to tie a URL to a value with the option tag, correct? I have examples of this in my code, but once again, I tried to leave this in its most basic form for the viewer.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...