I have this html:
<form action="/action_page.php">
<label for="qsearch">Qsearch</label>
<input id="search1" type="search" value="" name="s">
<br>
<label for="num">Num</label>
<input type="number" value="" name="Num">
<br>
<label for="a">A</label>
<input type="text" value="" name="a">
<br>
<label for="a">B</label>
<input type="text" value="" name="b">
<input type="submit">
</form>
<script>
console.log( document.getElementById("search1").closest("input[type='text']") );
</script>
I want to get the next text input closest to search input without knowing the ID. But i can't seems to use closest()
What is the correct way to do it using vanilla javascript?