I have created a small program that pulls from the YouTube API which allows you to search for a random video for whatever title you enter when prompted. My goal is to have this work like a search engine. I would like to make my search bar the input instead of the alert prompt window. Similarly, I would then also like to make the "Find" button act as the "Ok" button on the prompt alert window when you run the program with javascript in jsbin. Can someone point me in the proper direction to accomplish this? Here is the jsbin. I am assuming that I can just use some sort of OnClick function for the button, but not totally sure how to implement that and what I would call it on. Thank you!
PS. I'm certain you already know this, but just in case... Make sure you run the program in the jsbin with "Run with JS."
You can just add an
onclick
listener to the find button and trigger the code when someone clicks. You can get the value of the searchinput
instead of the prompt:Javascript:
HTML:
jsbin