Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Name of javascript course that teaches you how to connect a search bar to javascript code please.

Hi, I am working on a project and need to learn how to connect a search bar (on the web page) to javascript code. if anyone knows the name of this course, it would be much appreciated.

1 Answer

I would suggest the jQuery basics course (and any prereqs depending on your skill level). Depending on what you want to do, you may have to check out a backend language course (Node, PHP, Ruby, C# etc). That way, if you want to search a database for a value, you can connect the 2.

Basically, if the user can only put in a few valid search options (No more than 10 or so) and you'll have a nice error be thrown for anything else then you can just store those options in an array and use jQuery to get the value of that was given:

//when the submit button is clicked, grab the value that was in the input field
$('#submitButton').click(function() {
    var inputtedText = $('#inputFieldID').val();
    //Search your array to return content based on the input
};

Thank you, I have done the JQuery course a friend thought there was a javascript course specifically going through this, but couldn't remember the name. My searches in the library did not help. But I think I have found the way to approach it.