October 10, 20188 yr Hi I was wondering if anyone had a better solution to this, it seems excessive to me for what it is, it literally just changes the options within form fields to be displayed or hidden depending on services they choose.. thanks function Improvelist(){ //Selectboxes var inputImprove = document.getElementById('input-improve'); var inputTool = document.getElementById('input-tool'); //lists var improveWebsiteList = document.getElementById('improveWebsiteList'); var createWebsiteList = document.getElementById('createWebsiteList'); var improveSeoList = document.getElementById('improveSeoList'); var createSeoList = document.getElementById('createSeoList'); var improveGraphicsList = document.getElementById('improveGraphicsList'); var createGraphicsList = document.getElementById('createGraphicsList'); var graphicinvest = document.getElementById('graphicinvest'); var invest = document.getElementById('invest'); //if improve your seo if(inputImprove.value == 'Improve' && inputTool.value == 'seo'){ //show improve list by removing the hidden class $(improveSeoList).removeClass("hidden"); $(lives).removeClass('hidden'); $(graphicinvest).removeClass('hidden'); //hide all other 5 lists $(improveWebsiteList).addClass('hidden'); $(improveGraphicsList).addClass('hidden'); $(createSeoList).addClass('hidden'); $(createWebsiteList).addClass('hidden'); $(createGraphicsList).addClass('hidden'); $(invest).addClass('hidden'); //if improve your graphic design }else if(inputImprove.value == 'Improve' && inputTool.value == 'graphic design'){ //show improve graphic design list $(improveGraphicsList).removeClass('hidden'); $(graphicinvest).removeClass('hidden'); //hide all other 5 lists and live field $(lives).addClass('hidden'); $(improveWebsiteList).addClass('hidden'); $(improveSeoList).addClass('hidden'); $(createSeoList).addClass('hidden'); $(createWebsiteList).addClass('hidden'); $(createGraphicsList).addClass('hidden'); $(invest).addClass('hidden'); //if improve your website }else if(inputImprove.value == 'Improve' && inputTool.value == 'website'){ //show improve website lists and invest bar $(improveWebsiteList).removeClass('hidden'); //hide all other 5 lists and live field $(lives).removeClass('hidden'); $(invest).removeClass('hidden'); //hide improve seo list $(improveSeoList).addClass('hidden'); $(improveGraphicsList).addClass('hidden'); $(createSeoList).addClass('hidden'); $(createWebsiteList).addClass('hidden'); $(createGraphicsList).addClass('hidden'); $(graphicinvest).addClass('hidden'); //if create a new website }else if(inputImprove.value == 'Create' && inputTool.value == 'website'){ //show create website list $(createWebsiteList).removeClass('hidden'); //hide improve live list and invest bar $(lives).addClass('hidden'); $(invest).removeClass('hidden'); //hide all other 5 lists and live field $(createSeoList).addClass('hidden'); $(createGraphicsList).addClass('hidden'); $(improveWebsiteList).addClass('hidden'); $(improveSeoList).addClass('hidden'); $(improveGraphicsList).addClass('hidden'); $(graphicinvest).addClass('hidden'); //if create a new seo }else if(inputImprove.value == 'Create' && inputTool.value == 'seo'){ //show create seo list $(createSeoList).removeClass('hidden'); //hide all other 5 lists, live field and invest bar $(lives).removeClass('hidden'); $(graphicinvest).removeClass('hidden'); $(createWebsiteList).addClass('hidden'); $(createGraphicsList).addClass('hidden'); $(improveWebsiteList).addClass('hidden'); $(improveSeoList).addClass('hidden'); $(improveGraphicsList).addClass('hidden'); $(invest).addClass('hidden'); //If create a new graphic design }else if(inputImprove.value == 'Create' && inputTool.value == 'graphic design'){ //show create graphic design list $(createGraphicsList).removeClass('hidden'); //hide all other 5 lists, live field and invest bar $(graphicinvest).removeClass('hidden'); $(lives).addClass('hidden'); $(createWebsiteList).addClass('hidden'); $(createSeoList).addClass('hidden'); $(improveWebsiteList).addClass('hidden'); $(improveSeoList).addClass('hidden'); $(improveGraphicsList).addClass('hidden'); $(invest).addClass('hidden'); } }
Create an account or sign in to comment