javascript get value of input on button click
<form action="/"> <label for="">Whatever you want</label> <input type="text" id='form'> <input type="submit" id="submit"> </form> <script> const btn = document.getElementById('form'); btn.addEventListener('click', (e) => { e.preventDefault(); // disable the refresh on the page when submit const value = document.getElementById('submit').value; console.log(value); }); </script>