I have the following script which works just fine in a simple html file being launched from my browser:
$("*[scroll-to]").click((event) => {
// whatever here...
});
However, when using it with Blazor, it doesn't get triggered when clicking my button.
I found a workaround, which is replacing the first line with this instead:
$(document).delegate("*[scroll-to]", "click", function (event) {
Why do I have to do that? Why would it only stop working when using Blazor?
I also have a lot of other functions that are not working, such as this one for example, which doesn't add the display: none css attribute like it's supposed to:
if (!checkoutModal)
$("#checkoutModal").hide();
It basically does nothing, even tho it's being executed.
jQuery should be properly imported:

What can I do? Why is this happening and how can I fix it?