I added some dropdown menus from Materialize and I'm having issues with them being behind other elements (pic attached). I have tried changing the z-index of the options (z-index: 100;
) and the z-index of the other divs (z-index: -1;
).
HTML:
<div class="column source">
<label for="source1">Source of Income</label>
<select class="validate dark" id="source1" value="<?= income1Data[1] ?>" onchange="getHeader1();" required>
<option disabled><?= income1Data[1] ?></option>
<option>Employment</option>
<option>Unemployment</option>
<option>Social Security</option>
<option>Retirement</option>
<option>Side Job</option>
<option>Benefits</option>
<option>Bonus</option>
<option>Other</option>
</select>
</div>
<div class="table-body x18" id="bill-table">
<hr />
<div class="table-row x20">
<h3 class="title">Bills and Debt</h3>
</div>
</div>
JavaScript:
document.addEventListener('DOMContentLoaded', function() {
var elements = document.querySelectorAll('select');
var instances = M.FormSelect.init(elements);
};
CSS:
#bill-table {
z-index:-1;
}
ul.dropdown-content.select-dropdown li span {
z-index:100; //I used "color: red" to test and the color works, but z-index doesn't bring to front
}