Custom javascript problem

eventhough I have jquery in the head and it loads correctly because when I take it out bootstrap.js is complaining that it is not there:

script src=/Scripts/jquery-3.6.3.js defer

But I cannot execute this in the page:

<dot:Content ContentPlaceHolderID=“ScriptSection”>
script type=“text/javascript”>
$(document).ready(function () {

    });
</script>

</dot:Content>

it says $ is not defined

any idea?

That’s because the jQuery script with the defer attribute loads after the page processing is done, while the inline script is processed during the page load.

You can either remove the defer attribute (wouldn’t prefer), use type=module instead of type=text/javascript, or register jQuery as resource and convert the inline script <dot:InlineScript Dependencies=jquery />

ok, that worked thanks! Would never come up with it…

It took me like 4 years to come up with the type=module hack too (Allow type=module in InlineScriptResource by exyi · Pull Request #1823 · riganti/dotvvm · GitHub)