I wish to change the cursor property from pointer to default for option values which doesn't have any data. I made a map for the same which keeps a track of option values and the data content in it. This is how my code looks:
var newDataMap = {};
for (var i in payload) {
newDataMap[payload[i]data.year] = payload[i].data;
}
var year_html = '<option value = "all">All Years</option>';
for (var i in finYearTag) {
Object.keys(newDataMap).forEach(function eachKey(key) {
if(key == i) {
year_html += '<option value = "' + i + '"style = "cursor: pointer">' + finYearTag[i].name + '</option>';
}
else {
year_html += '<option value = "' + i + '"style = "cursor: default">' + finYearTag[i].name + '</option>';
}
});
}
$('#filterYear').html(year_html);
<select class="filt" id="filterYear" style="width: 180px;"></select>
The select options are populated dynamically using select2 and are working fine. I am just not able to get the cursor style change as intended. Please help.