當你在form中使用 button 時若沒有設定 type=”button” 就會觸發該表單的submit事件。
<form action="add.php" method="get">
<input type="text" name="key" />
<button>Search</button>
<button>Cancel</button>
</form>
當你在form中使用 button 時若沒有設定 type=”button” 就會觸發該表單的submit事件。
<form action="add.php" method="get">
<input type="text" name="key" />
<button>Search</button>
<button>Cancel</button>
</form>