javascript categories input object example

Solutions on MaxInterview for javascript categories input object example by the best coders in the world

showing results for - "javascript categories input object example"
Cyprien
22 Feb 2020
1    $('select').on('change', function () {
2        var subcategories = '';
3        var str = "This category contains these subcategories: ";
4        var result = str.bold();
5
6        switch (this.value) {
7               case 'Category 1':
8                subcategories = "Subcategory 1.1, Subcategory 1.2";
9                break;
10                
11                case 'Category 2':
12                subcategories = "Subcategory 2.1, Subcategory 2.2";
13                break;
14                
15                case 'Category 3':
16                subcategories = "Subcategory 3.1, Subcategory 3.2";
17                break;
18                
19                case 'Category 4':
20                subcategories = "Subcategory 4.1, Subcategory 4.2";
21                break;
22 
23        }
24        document.getElementById("showSubcategory").innerHTML = result + subcategories;
25    });
similar questions
queries leading to this page
javascript categories input object example