I need a quick fix for a build issue - basically a fe build shows a nicely designed button for dropbox upload - our developer has implemented the API by injecting the dropbox logo into the nicely designed html and left fro me to sort out - it basically looks like this -
the compiled code looks like this -
<li>
<a href="#" id="db-link" class="button">
<i class="icon-dropbox" id="dropbox_upload">
<a href="#" class=" dropbox-dropin-btn dropbox-dropin-default"><span class="dropin-btn-status"></span>Choose from Dropbox</a></i>
<span>Select from Dropbox</span>
</a>
</li>
As a quick fix - my approach is to hide the dropbox-dropin-btn link via a quick bit of css -
.dropbox-dropin-btn{
position:absolute;
top:-10000px;
}
and use javascript to trigger a click on the dropbox link when teh styled link is clicked - (jquery isnt used in this project) - I'll admit that i havent used vaniall javascript in some time - but Ive written this code -
document.getElementById("db-link").addEventListener("click", function(e) {
var l = document.getElementsByClassName("dropbox-dropin-btn");
l.click();
e.preventDefault();
});
WHich doesnt work - all i get is an error 'typeerror:getelementbyid is null'
Can anyone advise whts going wrong - or offer a better complete solution for this scenario?
Thanks