SyntaxFix
Write A Post
Hire A Developer
Questions
All you need to do is put a type tag and make the type button.
<button id="btnId" type="button">Hide/Show</button>
That solves the issue