getElementById not working inside condition

This is probably something I am doing wrong but this is not working, unless I take the image out of the condition, and then it works perfectly.

<script type="text/javascript" src="js/exif.js"></script>

<dmx-value id="var1" dmx-bind:value="1"></dmx-value>

<div id="conditional1" is="dmx-if" dmx-bind:condition="var1.value==1">
    <img src="uploadedPaul/DSCN0614_small.jpg" id="img1" />
</div>

<script>
    document.getElementById("img1").onclick = function() {
        EXIF.getData(this, function() {
            var make = EXIF.getTag(this, "Make"),
                model = EXIF.getTag(this, "Model");
            alert("I was taken by a " + make + " " + model);
        });
    }
</script>

Working Result

Community Page
Last updated: