如何随图像一起填充下拉菜单的选定值。我在css文件中定义了图像,如下所示。选择时,仅填充文本,而不填充图像。如何使图像也随文本一起填充
<div class="transportDropdown input-field">
<select>
<option value="1">Home</option>
<option value="2">Transport</option>
</select>
</div>
ngOnInit() {
$(document).ready(function () {
$('.transportDropdown select').formSelect();
});
}
.transportDropdown li:first-child span{
background-image: url(../images/pfm_home_grey.svg);
}
.transportDropdown li:nth-child(2) span{
background-image: url(../images/pfm_cars_grey.svg);
}