I want to check if the nextElementSibling Element is present and if it is a field. But I don't find the correct JS request.
document.getElementById($id).nextElementSibling.type
does not work.
You need to use nodeName, or tagName.
var nextElement = document.getElementById('demo').nextElementSibling.nodeName;
console.log(nextElement);
<div id="demo">
<p>
hola
</p>
</div>
<p>
next element
</p>