I'm trying to load an external JavaScript file into an HTML file. Both are placed in the assets folder.
This is my htmlTest.html file:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
<script src="test.js"></script>
</head>
<body>
<script type="text/javascript">
func();
</script>
</body>
And this is my test.js file:
function func(){
$(document).ready(function () {
$('#EDIFICI').children().click(function () {
alert($(this).attr('id'));
});
});
}
Both files are located in the root of the assets folder. I load htmlTest.html into my WebView like this:
wv.loadUrl("file:///android_asset/htmlTest.html");
If I put JavaScript code inline directly inside the HTML page it works, but it doesn't when I link an external JavaScript file.