If you really need the JavaScript + HTML, but they are dependent, you could try to put all the HTML + JS in one HTMLSnippet widget. Set the widget to HTML and add the JavaScript in between the script tags:
<script type="text/javascript">
your code;
</script>
The fastest approach is to add the HTML snippet where needed and link the JavaScript files directly in the index.html file of your theme directory.