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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:33:10+00:00 2026-06-12T14:33:10+00:00

I have seen forks of the bootstrap typeahead plugin like this one here: https://gist.github.com/1866577

  • 0

I have seen forks of the bootstrap typeahead plugin like this one here:

https://gist.github.com/1866577

However, I am not able to understand how to build the form elements I need for my web application. Basically, I would like my web application to mimic the functionality provided by the following website:

slugbooks.com

I need 3 autocomplete forms like they have on that website.. but I want to use Twitter Bootstrap as the rest of my web app is in Bootstrap. I need the first autocomplete like for the colleges… This is easy to do with the bootstrap typeahead plugin. I have figured this part out. Now the next to dropdowns with autocomplete is where it gets complex..

I have already learned how to make typeahead dropdowns thanks to this StackOverflow question:

Adding a dropdown button to Twitter bootstrap typeahead component

Now I just need a way to dynamically generate the data source for the drop downs based on which college is selected and then which department is selected. Also, selecting the appropriate course (3rd dropdown) should redirect me to a specific page (eg: site.com/college/coursename.html)

How would I accomplish this with Twitter Bootstrap Typeahead?

Data Example:

Colleges :

  • UTEXAS
  • UMIAMI
  • USC
  • STANFORD

Departments:

  • 1,2,3 <= STANFORD
  • 4,5,6 <= USC
  • 7,8,9 <= UMIAMI
  • A,B,C <= UTEXAS

Courses:

  • a <= 1
  • b <= 2
  • c <= 3
  • d <= 4
  • e <= 5
  • f <= 6
  • g <= 7
  • h <= 8
  • i <= 9
  • j <= A
  • k <= B
  • l <= C

Warning: I’m a javascript/AJAX noob so please guide me well if javascript/AJAX is involved…

  • 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-06-12T14:33:11+00:00Added an answer on June 12, 2026 at 2:33 pm

    Here is something that should get you started : Live demo (jsfiddle)

    // This wrapping is here only for visibility on JSFIDDLE (and because it's fun)
    !function(colleges, ajaxLoadDepartments){
        var $one = $('#one');
        var $two= $('#two');
    
        var loadSourceForTwoWith = function(item) {  // Function that reset the departments, accepts the name of the college
            $two.data('typeahead', false).val('');       // Clear departments
            ajaxLoadDepartments(item, function(departments) {     // This fonction should be the success of the ajax call
                $two.typeahead({                           // this ajax call should return the departments of the `item` college
                    source: departments                    // as an array of strings
                }).focus();
            });
        };
    
        $one.typeahead({
            source: colleges,
            updater: function(item) { // Item is selected, should return item
                loadSourceForTwoWith(item);
                return item;
            }
        });
    
    }( /* Don't bother too much with what's below, just use your what is above with your real code(ajax) and data */
        ['UTEXAS', 'UMIAMI', 'USC', 'STANFORD'],
        function(item, callback) {
            var jsonResponse = {
                'STANFORD' : ['X1','X2','X3'],
                'USC' : ['X4','X5','X6'],
                'UMIAMI' : ['X7','X8','X9'],
                'UTEXAS' : ['XA','XB','XC']
            };
    
            $.ajax('/echo/json/', {
                type: 'post',
                data: {json: JSON.stringify(jsonResponse[item])}
            }).done(function(data) {
                callback(data);
            });
        }
    );
    

    This simplistic example shows you how to :

    • Set your own callback for selected items : see updater
    • Reset a typeahead source (the very hard way) : see .data('typeahead', false)
    • Use callback functions to load asynchronously
    • Mess with people head in JS

    Before any copy/paste, you should know that this uses only the standard typeahead plugin and nothing is done about error handling (input, ajax error, latency user-awareness)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've noticed that there are about 30 forks of Django Piston on GitHub: https://github.com/search?q=django-piston&type=Everything&repo=&langOverride=&start_value=1
I have seen many posting this issue in SO. I have gone through those
I have seen in a few libraries, Spray for example, dual package specifications like
I have seen questions posted on here asking how to left and right align
I have seen this talked about but never answered. Maybe it has and I'm
Here's a question you may have seen around the 'nets in various forms...summed up
I have seen normal http websites which use an 'https' url for their login
I have seen this everywhere and tried all the solutions and am not seeming
I have seen this same question in many forms on this site and in
From what I have seen, in the MSDN documentation and in other questions here

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.