JavaScript – Placing an array in list via /r/learnprogramming


JavaScript – Placing an array in list

I'm trying to place an array in a list using Javascript. The user picks a selection from a drop down list and clicks a button. Then it produces a list of the needed skills for that particular selection. HTML:

 <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 --> 

JavaScript:

function showSkillsIf(){ //Selects element in DOM with option as its tag var options = document.getElementsByTagName("option") var skillProgram =['Detail Orientated', 'Java', 'Problem Solving']; var skillDataScientist = ['R', 'Analytical Thinker', 'Python', 'Statistics']; var skillDatabase = ['SQL', 'Oracle', 'Organized']; var skillSoftware = ['Detail Orientated', 'C', 'C++', 'Java', 'Organized']; //Determining which option is selected if (options[0].selected){ document.createElement('ul') } else if (options[1].selected){ } else if (options[2].selected){ } else if (options[3].selected){ } 

}

Any thoughts or suggestions would be much appreciated. Thanks!

Submitted July 14, 2017 at 07:23PM by B2easey
via reddit http://ift.tt/2t06diW

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