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

HTML

HTML input type=text How I can execute any input? or have href another html depending on the input.

HTML
-Form, Input, Action.
I am trying to have any text from, input type="text", to href or action. Depending on the text input to href or action another html or mp4. I may need to action= php or java, but I would like to keep it all in one page.

Ex. If the user inputs "Videos" in the text box, he would be redirected to a Videos.html
--Else if there isn't a Videos html setup yet, it would refresh the Main.html

Not a search engine.
Would appreciate any and all help.

Post your code

<!DOCTYPE html PUBLIC> <html> <head><meta charset="utf-8"> <title>Test</title> <link rel="stylesheet" href="Nor.css"> <link rel="stylesheet" href="Main.css"> </head> <body> <img src="1.png"> <form> <input class="Log" type="text"> </form> </body> </html>

Hey Kevin-

I want to try and help here, but let me clarify what I think you are saying first. Do you want to execute a search that returns links (href) or music/videos (mp4)? If so, my suggestion would be to learn how functions work using Javascript, JQuery and AJAX (front end development track here on treehouse). Javascript is for interactivity treehouse has videos that will help. Here is a link to a sample video that goes into the search functionality:

http://teamtreehouse.com/library/ajax-basics/ajax-and-apis/stage-4-challenge-answer

I hope this is helpful, let me know if you are looking for something else.

-Stephen

1 Answer

Kevin you will need to write a Javascript function to achieve your task.

You need to select the input element then retrieve its value. I do not know of a way to do this in HTML.