I have problems accessing my form from the JS file, and I don't know how to access it. Here's my code:
$("#my-form").submit(function(e) {
e.preventDefault();
var textInput = $("#my-input").val();
$("#container").html(textInput);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="container" class="container-fluid"></div>
<script id="view-contact" type="text/html">
<form id="my-form" class="form">
<input id="my-input" type="text">
<input type="submit">
</form>
</script>
<script>tag around your form? Remove it, then your code will work.<script>as some for of hack replacement for a<template>element (or even if you're using an actual template element) then there isn't going to be a submit button to trigger the submit event without some code to create an actual form in the document. Provide a minimal reproducible example