JavaScript – Determining what option is selected in drop down box. via /r/learnprogramming


JavaScript – Determining what option is selected in drop down box.

I have this HTML code:

 <!-- Creating drop down list --> <select id = "dropdown"> <option disabled selected>What is your dream job to start off?</option> <option value="Programmer">Programmer</option> <option value="dataScientist">Data Scientist</option> <option value="databaseAdministrator">Database Administrator</option> <option value="softwareEngineer">Software Engineer</option> </select> <!-- Creating two buttons --> <input type = "button" name = "IF: What skills do I need?" value = "IF: What skills do I need?" onclick="showSkillsIf()"> <input type = "button" name = "SWITCH: What skills do I need?" value = "SWITCH: What skills do I need?" onclick = "showSkillsSwitch()"> <!-- The skills necessary for particular job --> 

I want to determine which option the user has selected and based on the selected option when they click on a button it will show the skills needed based on their selection.

I'm not sure how I can go about determining which is selected, and how to populate a list with the certain skills while using Javascript.

Any help would be nice, thanks!

Submitted July 13, 2017 at 08:33PM by B2easey
via reddit http://ift.tt/2ukwfkt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s