I have a function in the script tag that initializes a couple of scripts in a separate file called "filters.js". But for some reason it returns "initialize is not defined". Does wrapping the function in jQuery change the scope? Here is my html:
<!DOCTYPE html>
<html>
<head>
<script src="Scripts/filters.js"></script>
<script src="Scripts/jquery-3.3.1.js"></script>
<meta charset="utf-8" />
<title>ICTV Filters</title>
</head>
<body>
<div class="filterCategory">
<div class="categoryTitle">
Genome
<input type="checkbox" id="ssDNA" />
<label for="ssDNA">ssDNA</label>
<input type="checkbox" id="dsDNA" />
<label for="dsDNA">dsDNA</label>
<input type="checkbox" id="ssRNA" />
<label for="ssRNA">ssRNA</label>
<input type="checkbox" id="dsRNA" />
<label for="dsRNA">dsRNA</label>
<button onclick="initialize()">Apply Filters</button> <!-- Returns error on this line-->
</div>
</div>
<div class="filterReturn">
<p id="filterReplace"></p>
</div>
<script>
jQuery(document).ready(function () {
function initialize() {
getSelections();
updateObject();
updateLocalStorage();
$(document).trigger('filtersUpdated');
}
})
</script>
</body>
</html>