How do I implement a function to display values when selecting different choices(including multi choice from one dropdown) from multi dropdown list selection for instance, the html would be
<!DOCTYPE html>
<html>
<body>
<div>
<select name="entities">
<option value="0">--Select one item--</option>
<option value="1">entity1</option>
<option value="2">entity2</option>
<option value="3">entity3</option>
</select>
</div>
<div>
<select name="categories" multiple>
<option value="0">--Select one item--</option>
<option value="1">category1</option>
<option value="2">category2</option>
<option value="3">category3</option>
</select>
</div>
<p> Display values </p>
<div id="displayValues"></div>
</body>
</html>
For example, the display rules that need to satisfy the following table
|--------------------------|------------------|----------------------|
| Display Value | Entities | Categories |
|--------------------------|------------------|----------------------|
| "value1" | entity1 | category1 |
|--------------------------|------------------|----------------------|
| "value2" | entity2 | category1 |
|--------------------------|------------------|----------------------|
| "value3" | entity1 | category2 |
|--------------------------|------------------|----------------------|
| "value4" | entity1 | category1 & category2|
|--------------------------|------------------|----------------------|
| ... | ... | ... |
how can I create a generic javascript function to control the display value for different conditions? instead of writing all conditions using if else inside the function? (ps.may write a generic function and a seperate dictionary for containing all rules??)