Универсальный способ
<style>
.cl1 {opacity:0; }
.cl2 {opacity:0.5; }
.cl3 {opacity:1; }
.cl4 {opacity:0; }
</style>
<div id = "d1" class = "cl4"></div>
<div id = "d2" class = "cl3"></div>
<div id = "d3" class = "cl2"></div>
<div id = "d4" class = "cl1"></div>
<div id = "d5" style="opacity:1;"></div>
<script>
[].forEach.call(document.querySelectorAll('div'), function (it) {
if(getComputedStyle(it).opacity == 1) alert(it.id);
});
</script>