I have an HTML form that disable submit button if both fields have the same for, but I want it the submit button to be hidden instead, please how can I do that?
<form id="my-form" action="" method="post">
<input type="text" id="inp-1" value="">
<input type="text" id="inp-2" value="">
<button type="submit">Signup project</button>
</form>
<script>
/** select the form and both the inputs, select them once and use them as many as needed */
const myForm = document.getElementById('my-form'),
inp1 = document.getElementById('inp-1'),
inp2 = document.getElementById('inp-2');
/**
* listen for "submit" events on the form
* if the trimmed values of both the inputs is the same then we prevent the form from being submitted
*/
myForm.addEventListener('submit', e => inp1.value.trim() === inp2.value.trim() && e.preventDefault());
</script>