I want to target a specified div, but my example for now is only when it has an id. I want to use pure Javascript
current:
<div id="my_id">hello</div>
<script>
document.getElementById('my_id').insertAdjacentHTML('beforebegin',
'<h3>text</h3>');
</script>
my case:
<div data-foo="bar">hello</div>
<div data-foo="club">hi</div>
How can I target the div that has the bar data-foo attribute ?