We can get the form that contains the input element with the form
property of the input.
For instance, if we have the following form:
<form>
<input>
</form>
Then we can get the form that contains the input by writing:
const input = document.querySelector('input')
console.log(input.form)
We just use the form
property to get the form element that contains the input.