JS in fluid template behavior ... in most cases, it's terrible if your JS code contains any curly braces, you need to include an external script instead of placing the script in the view.
The reason is because Fluid thinks that all curly braces belong to its volume, so when you write:
$('#mySelectBox').change(function() {
});
Fluid destroys JS and displays it as simply:
$('#mySelectBox').change(function() Array);
Then most often I use something like this:
in view:
<script>var TxMyExtKeyTabNumber = {tab}</script>
<script src="path/to/static/script.js"></script>
in script.js:
$("#container").val(TxMyExtKeyTabNumber);