Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Excessive Javascript form elseif

Featured Replies

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.